Skip to content

Commit

Permalink
Merge pull request #15 from dimonovdd/featureThumbSize
Browse files Browse the repository at this point in the history
[Enhancement] Slider Thumb Size and Convert Range
  • Loading branch information
jsuarezruiz authored Mar 1, 2021
2 parents b2c50a9 + cda2873 commit 776f1bf
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 134 deletions.
33 changes: 23 additions & 10 deletions src/TemplateUI.Gallery.Android/TemplateUI.Gallery.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms.FontAwesome.Brand">
<Version>1.0.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand Down Expand Up @@ -234,24 +237,34 @@
</Generator>
</AndroidResource>
<AndroidResource Include="Resources\drawable\snackbar.png">
<SubType></SubType>
<Generator></Generator>
<SubType>
</SubType>
<Generator>
</Generator>
</AndroidResource>
<AndroidResource Include="Resources\drawable\divider.png">
<SubType></SubType>
<Generator></Generator>
<SubType>
</SubType>
<Generator>
</Generator>
</AndroidResource>
<AndroidResource Include="Resources\drawable\circularlayout.png">
<SubType></SubType>
<Generator></Generator>
<SubType>
</SubType>
<Generator>
</Generator>
</AndroidResource>
<AndroidResource Include="Resources\drawable\docklayout.png">
<SubType></SubType>
<Generator></Generator>
<SubType>
</SubType>
<Generator>
</Generator>
</AndroidResource>
<AndroidResource Include="Resources\drawable\hexlayout.png">
<SubType></SubType>
<Generator></Generator>
<SubType>
</SubType>
<Generator>
</Generator>
</AndroidResource>
</ItemGroup>
<ItemGroup />
Expand Down
3 changes: 3 additions & 0 deletions src/TemplateUI.Gallery.iOS/TemplateUI.Gallery.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms.FontAwesome.Brand">
<Version>1.0.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TemplateUI.Gallery\TemplateUI.Gallery.csproj">
Expand Down
30 changes: 20 additions & 10 deletions src/TemplateUI.Gallery.macOS/TemplateUI.Gallery.macOS.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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')" />
<PropertyGroup>
Expand Down Expand Up @@ -28,15 +28,19 @@
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<UseSGen>true</UseSGen>
<UseRefCounting>true</UseRefCounting>
<HttpClientHandler></HttpClientHandler>
<LinkMode></LinkMode>
<XamMacArch></XamMacArch>
<HttpClientHandler>
</HttpClientHandler>
<LinkMode>
</LinkMode>
<XamMacArch>
</XamMacArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<DefineConstants></DefineConstants>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnableCodeSigning>false</EnableCodeSigning>
Expand All @@ -47,10 +51,18 @@
<UseRefCounting>true</UseRefCounting>
<CodeSignEntitlements>Entitlements.plist</CodeSignEntitlements>
<LinkMode>SdkOnly</LinkMode>
<HttpClientHandler></HttpClientHandler>
<XamMacArch></XamMacArch>
<HttpClientHandler>
</HttpClientHandler>
<XamMacArch>
</XamMacArch>
</PropertyGroup>
<ItemGroup>
<Reference Include="FontAwesome.Brand, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.FontAwesome.Brand.1.0.0\lib\netstandard2.0\FontAwesome.Brand.dll</HintPath>
</Reference>
<Reference Include="IconFontHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.IconFontHelper.1.0.0\lib\netstandard2.0\IconFontHelper.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
Expand Down Expand Up @@ -81,9 +93,7 @@
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512%402x.png" />
<ImageAsset Include="Assets.xcassets\Contents.json" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
Expand Down
2 changes: 2 additions & 0 deletions src/TemplateUI.Gallery.macOS/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="xamarinmac20" />
<package id="Xamarin.Essentials" version="1.3.1" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms" version="4.7.0.1351" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms.FontAwesome.Brand" version="1.0.0" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms.IconFontHelper" version="1.0.0" targetFramework="xamarinmac20" />
</packages>
1 change: 1 addition & 0 deletions src/TemplateUI.Gallery/TemplateUI.Gallery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms.FontAwesome.Brand" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
78 changes: 61 additions & 17 deletions src/TemplateUI.Gallery/Views/SliderGallery.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:TemplateUI.Controls;assembly=TemplateUI"
xmlns:controls="clr-namespace:TemplateUI.Controls;assembly=TemplateUI"
xmlns:iconsB="clr-namespace:FontAwesome.Brand;assembly=FontAwesome.Brand"
x:Class="TemplateUI.Gallery.Views.SliderGallery"
Title="Slider Gallery">
<ContentPage.Content>
<StackLayout
Padding="12">
Padding="12" Spacing="0">
<Label
Text="Getting Started"/>
<controls:Slider
Expand All @@ -16,38 +17,81 @@
Value="5"
ValueChanged="OnSliderValueChanged"/>
<Label
Text="Customize the background colors"/>
Text="Customize the background colors" Margin="0,10,0,0"/>
<controls:Slider
Value="3"
BackgroundColor="LightCoral"/>
<Label
Text="Customize the track colors"/>
Text="Customize the track colors" Margin="0,10,0,0"/>
<controls:Slider
Minimum="0"
MinimumTrackColor="Red"
Maximum="10"
MaximumTrackColor="Blue"
Value="7"/>
<Label
Text="Customize the thumb colors"/>
<controls:Slider
ThumbColor="Orange"
ThumbBorderColor="Red"
Minimum="0"
MinimumTrackColor="LightCoral"
Maximum="10"
MaximumTrackColor="DarkOrange"
Value="4"/>
<Label
Text="Customize the track size"/>
Text="Customize the track size" Margin="0,10,0,0"/>
<controls:Slider
TrackSize="4"
ThumbColor="Green"
Minimum="0"
MinimumTrackColor="LightGreen"
Maximum="10"
MaximumTrackColor="DarkGreen"
Value="2"/>
<Label
Text="Customize the thumb" Margin="0,10,0,0"/>
<controls:Slider x:Name="changingSlider"
TrackSize="4"
Minimum="2"
MinimumTrackColor="LightGreen"
Maximum="10"
MaximumTrackColor="LightGreen"
Value="12"
Margin="0">
<controls:Slider.Thumb>
<Frame BackgroundColor="Black" CornerRadius="10" HeightRequest="60" WidthRequest="60" Padding="0" Margin="0">
<Grid>
<Image Margin="5" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Image.Source>
<iconsB:IconSource Icon="GithubAlt" Color="Red"/>
</Image.Source>
</Image>
<BoxView BackgroundColor="Red" HeightRequest="10" WidthRequest="2" Margin="0" VerticalOptions="End" HorizontalOptions="Center"/>
</Grid>
</Frame>
</controls:Slider.Thumb>
</controls:Slider>

<Grid Margin="0" Padding="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<BoxView Grid.Column="1" BackgroundColor="Red" HeightRequest="10" Margin="0" />
<Label Text="Center" Grid.Row="1" Grid.ColumnSpan="3" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center"/>
</Grid>

<Label TextColor="Black" FontAttributes="Bold" Margin="0,10,0,0">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Minimum: "/>
<Span Text="{Binding Minimum, Source={x:Reference changingSlider}}"/>
<Span Text="&#10;"/>
<Span Text="Maximum: "/>
<Span Text="{Binding Maximum, Source={x:Reference changingSlider}}"/>
<Span Text="&#10;"/>
<Span Text="Value: "/>
<Span Text="{Binding Value, Source={x:Reference changingSlider}}"/>
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
</ContentPage.Content>
</ContentPage>
</ContentPage>
Loading

0 comments on commit 776f1bf

Please sign in to comment.