Skip to content

Commit 776f1bf

Browse files
authored
Merge pull request #15 from dimonovdd/featureThumbSize
[Enhancement] Slider Thumb Size and Convert Range
2 parents b2c50a9 + cda2873 commit 776f1bf

8 files changed

Lines changed: 226 additions & 134 deletions

File tree

src/TemplateUI.Gallery.Android/TemplateUI.Gallery.Android.csproj

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
<ItemGroup>
5656
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
5757
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
58+
<PackageReference Include="Xamarin.Forms.FontAwesome.Brand">
59+
<Version>1.0.0</Version>
60+
</PackageReference>
5861
</ItemGroup>
5962
<ItemGroup>
6063
<Compile Include="MainActivity.cs" />
@@ -234,24 +237,34 @@
234237
</Generator>
235238
</AndroidResource>
236239
<AndroidResource Include="Resources\drawable\snackbar.png">
237-
<SubType></SubType>
238-
<Generator></Generator>
240+
<SubType>
241+
</SubType>
242+
<Generator>
243+
</Generator>
239244
</AndroidResource>
240245
<AndroidResource Include="Resources\drawable\divider.png">
241-
<SubType></SubType>
242-
<Generator></Generator>
246+
<SubType>
247+
</SubType>
248+
<Generator>
249+
</Generator>
243250
</AndroidResource>
244251
<AndroidResource Include="Resources\drawable\circularlayout.png">
245-
<SubType></SubType>
246-
<Generator></Generator>
252+
<SubType>
253+
</SubType>
254+
<Generator>
255+
</Generator>
247256
</AndroidResource>
248257
<AndroidResource Include="Resources\drawable\docklayout.png">
249-
<SubType></SubType>
250-
<Generator></Generator>
258+
<SubType>
259+
</SubType>
260+
<Generator>
261+
</Generator>
251262
</AndroidResource>
252263
<AndroidResource Include="Resources\drawable\hexlayout.png">
253-
<SubType></SubType>
254-
<Generator></Generator>
264+
<SubType>
265+
</SubType>
266+
<Generator>
267+
</Generator>
255268
</AndroidResource>
256269
</ItemGroup>
257270
<ItemGroup />

src/TemplateUI.Gallery.iOS/TemplateUI.Gallery.iOS.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@
126126
<ItemGroup>
127127
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
128128
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
129+
<PackageReference Include="Xamarin.Forms.FontAwesome.Brand">
130+
<Version>1.0.0</Version>
131+
</PackageReference>
129132
</ItemGroup>
130133
<ItemGroup>
131134
<ProjectReference Include="..\TemplateUI.Gallery\TemplateUI.Gallery.csproj">

src/TemplateUI.Gallery.macOS/TemplateUI.Gallery.macOS.csproj

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props" Condition="Exists('..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props')" />
44
<PropertyGroup>
@@ -28,15 +28,19 @@
2828
<IncludeMonoRuntime>false</IncludeMonoRuntime>
2929
<UseSGen>true</UseSGen>
3030
<UseRefCounting>true</UseRefCounting>
31-
<HttpClientHandler></HttpClientHandler>
32-
<LinkMode></LinkMode>
33-
<XamMacArch></XamMacArch>
31+
<HttpClientHandler>
32+
</HttpClientHandler>
33+
<LinkMode>
34+
</LinkMode>
35+
<XamMacArch>
36+
</XamMacArch>
3437
</PropertyGroup>
3538
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3639
<DebugType>pdbonly</DebugType>
3740
<Optimize>true</Optimize>
3841
<OutputPath>bin\Release</OutputPath>
39-
<DefineConstants></DefineConstants>
42+
<DefineConstants>
43+
</DefineConstants>
4044
<ErrorReport>prompt</ErrorReport>
4145
<WarningLevel>4</WarningLevel>
4246
<EnableCodeSigning>false</EnableCodeSigning>
@@ -47,10 +51,18 @@
4751
<UseRefCounting>true</UseRefCounting>
4852
<CodeSignEntitlements>Entitlements.plist</CodeSignEntitlements>
4953
<LinkMode>SdkOnly</LinkMode>
50-
<HttpClientHandler></HttpClientHandler>
51-
<XamMacArch></XamMacArch>
54+
<HttpClientHandler>
55+
</HttpClientHandler>
56+
<XamMacArch>
57+
</XamMacArch>
5258
</PropertyGroup>
5359
<ItemGroup>
60+
<Reference Include="FontAwesome.Brand, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
61+
<HintPath>..\packages\Xamarin.Forms.FontAwesome.Brand.1.0.0\lib\netstandard2.0\FontAwesome.Brand.dll</HintPath>
62+
</Reference>
63+
<Reference Include="IconFontHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
64+
<HintPath>..\packages\Xamarin.Forms.IconFontHelper.1.0.0\lib\netstandard2.0\IconFontHelper.dll</HintPath>
65+
</Reference>
5466
<Reference Include="System" />
5567
<Reference Include="System.Core" />
5668
<Reference Include="Xamarin.Mac" />
@@ -81,9 +93,7 @@
8193
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512%402x.png" />
8294
<ImageAsset Include="Assets.xcassets\Contents.json" />
8395
</ItemGroup>
84-
<ItemGroup>
85-
<Folder Include="Resources\" />
86-
</ItemGroup>
96+
<ItemGroup />
8797
<ItemGroup>
8898
<None Include="Info.plist" />
8999
<None Include="Entitlements.plist" />

src/TemplateUI.Gallery.macOS/packages.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="xamarinmac20" />
44
<package id="Xamarin.Essentials" version="1.3.1" targetFramework="xamarinmac20" />
55
<package id="Xamarin.Forms" version="4.7.0.1351" targetFramework="xamarinmac20" />
6+
<package id="Xamarin.Forms.FontAwesome.Brand" version="1.0.0" targetFramework="xamarinmac20" />
7+
<package id="Xamarin.Forms.IconFontHelper" version="1.0.0" targetFramework="xamarinmac20" />
68
</packages>

src/TemplateUI.Gallery/TemplateUI.Gallery.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<ItemGroup>
1414
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
1515
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
16+
<PackageReference Include="Xamarin.Forms.FontAwesome.Brand" Version="1.0.0" />
1617
</ItemGroup>
1718

1819
<ItemGroup>

src/TemplateUI.Gallery/Views/SliderGallery.xaml

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
<ContentPage
33
xmlns="http://xamarin.com/schemas/2014/forms"
44
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5-
xmlns:controls="clr-namespace:TemplateUI.Controls;assembly=TemplateUI"
5+
xmlns:controls="clr-namespace:TemplateUI.Controls;assembly=TemplateUI"
6+
xmlns:iconsB="clr-namespace:FontAwesome.Brand;assembly=FontAwesome.Brand"
67
x:Class="TemplateUI.Gallery.Views.SliderGallery"
78
Title="Slider Gallery">
89
<ContentPage.Content>
910
<StackLayout
10-
Padding="12">
11+
Padding="12" Spacing="0">
1112
<Label
1213
Text="Getting Started"/>
1314
<controls:Slider
@@ -16,38 +17,81 @@
1617
Value="5"
1718
ValueChanged="OnSliderValueChanged"/>
1819
<Label
19-
Text="Customize the background colors"/>
20+
Text="Customize the background colors" Margin="0,10,0,0"/>
2021
<controls:Slider
2122
Value="3"
2223
BackgroundColor="LightCoral"/>
2324
<Label
24-
Text="Customize the track colors"/>
25+
Text="Customize the track colors" Margin="0,10,0,0"/>
2526
<controls:Slider
2627
Minimum="0"
2728
MinimumTrackColor="Red"
2829
Maximum="10"
2930
MaximumTrackColor="Blue"
3031
Value="7"/>
3132
<Label
32-
Text="Customize the thumb colors"/>
33-
<controls:Slider
34-
ThumbColor="Orange"
35-
ThumbBorderColor="Red"
36-
Minimum="0"
37-
MinimumTrackColor="LightCoral"
38-
Maximum="10"
39-
MaximumTrackColor="DarkOrange"
40-
Value="4"/>
41-
<Label
42-
Text="Customize the track size"/>
33+
Text="Customize the track size" Margin="0,10,0,0"/>
4334
<controls:Slider
4435
TrackSize="4"
45-
ThumbColor="Green"
4636
Minimum="0"
4737
MinimumTrackColor="LightGreen"
4838
Maximum="10"
4939
MaximumTrackColor="DarkGreen"
5040
Value="2"/>
41+
<Label
42+
Text="Customize the thumb" Margin="0,10,0,0"/>
43+
<controls:Slider x:Name="changingSlider"
44+
TrackSize="4"
45+
Minimum="2"
46+
MinimumTrackColor="LightGreen"
47+
Maximum="10"
48+
MaximumTrackColor="LightGreen"
49+
Value="12"
50+
Margin="0">
51+
<controls:Slider.Thumb>
52+
<Frame BackgroundColor="Black" CornerRadius="10" HeightRequest="60" WidthRequest="60" Padding="0" Margin="0">
53+
<Grid>
54+
<Image Margin="5" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
55+
<Image.Source>
56+
<iconsB:IconSource Icon="GithubAlt" Color="Red"/>
57+
</Image.Source>
58+
</Image>
59+
<BoxView BackgroundColor="Red" HeightRequest="10" WidthRequest="2" Margin="0" VerticalOptions="End" HorizontalOptions="Center"/>
60+
</Grid>
61+
</Frame>
62+
</controls:Slider.Thumb>
63+
</controls:Slider>
64+
65+
<Grid Margin="0" Padding="0">
66+
<Grid.ColumnDefinitions>
67+
<ColumnDefinition Width="*"/>
68+
<ColumnDefinition Width="2"/>
69+
<ColumnDefinition Width="*"/>
70+
</Grid.ColumnDefinitions>
71+
<Grid.RowDefinitions>
72+
<RowDefinition Height="auto"/>
73+
<RowDefinition Height="auto"/>
74+
</Grid.RowDefinitions>
75+
<BoxView Grid.Column="1" BackgroundColor="Red" HeightRequest="10" Margin="0" />
76+
<Label Text="Center" Grid.Row="1" Grid.ColumnSpan="3" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center"/>
77+
</Grid>
78+
79+
<Label TextColor="Black" FontAttributes="Bold" Margin="0,10,0,0">
80+
<Label.FormattedText>
81+
<FormattedString>
82+
<FormattedString.Spans>
83+
<Span Text="Minimum: "/>
84+
<Span Text="{Binding Minimum, Source={x:Reference changingSlider}}"/>
85+
<Span Text="&#10;"/>
86+
<Span Text="Maximum: "/>
87+
<Span Text="{Binding Maximum, Source={x:Reference changingSlider}}"/>
88+
<Span Text="&#10;"/>
89+
<Span Text="Value: "/>
90+
<Span Text="{Binding Value, Source={x:Reference changingSlider}}"/>
91+
</FormattedString.Spans>
92+
</FormattedString>
93+
</Label.FormattedText>
94+
</Label>
5195
</StackLayout>
5296
</ContentPage.Content>
53-
</ContentPage>
97+
</ContentPage>

0 commit comments

Comments
 (0)