Skip to content

Commit 31492de

Browse files
authored
IndicatorView visual state (xamarin#713)
* Use Selected VisualState. * Remove style name. * Revert "Remove style name." This reverts commit 79013ab.
1 parent 7af9f32 commit 31492de

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

UserInterface/IndicatorViewDemos/IndicatorViewDemos.Android/IndicatorViewDemos.Android.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<Reference Include="System.Numerics.Vectors" />
5353
</ItemGroup>
5454
<ItemGroup>
55-
<PackageReference Include="Xamarin.Forms" Version="5.0.0.1874" />
55+
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
5656
</ItemGroup>
5757
<ItemGroup>
5858
<Compile Include="MainActivity.cs" />

UserInterface/IndicatorViewDemos/IndicatorViewDemos.iOS/IndicatorViewDemos.iOS.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
<Reference Include="System.Numerics.Vectors" />
121121
</ItemGroup>
122122
<ItemGroup>
123-
<PackageReference Include="Xamarin.Forms" Version="5.0.0.1874" />
123+
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
124124
</ItemGroup>
125125
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
126126
<ItemGroup>

UserInterface/IndicatorViewDemos/IndicatorViewDemos/IndicatorViewDemos.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Xamarin.Forms" Version="5.0.0.1874" />
9+
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
1010
</ItemGroup>
1111
<ItemGroup>
1212
<Folder Include="Models\" />

UserInterface/IndicatorViewDemos/IndicatorViewDemos/Views/TemplatedIndicatorViewPage.xaml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,31 @@
77
<ContentPage.BindingContext>
88
<viewmodels:MonkeysViewModel />
99
</ContentPage.BindingContext>
10+
11+
<ContentPage.Resources>
12+
<Style x:Key="IndicatorLabelStyle"
13+
TargetType="Label">
14+
<Setter Property="VisualStateManager.VisualStateGroups">
15+
<VisualStateGroupList>
16+
<VisualStateGroup x:Name="CommonStates">
17+
<VisualState x:Name="Normal">
18+
<VisualState.Setters>
19+
<Setter Property="TextColor"
20+
Value="LightGray" />
21+
</VisualState.Setters>
22+
</VisualState>
23+
<VisualState x:Name="Selected">
24+
<VisualState.Setters>
25+
<Setter Property="TextColor"
26+
Value="Black" />
27+
</VisualState.Setters>
28+
</VisualState>
29+
</VisualStateGroup>
30+
</VisualStateGroupList>
31+
</Setter>
32+
</Style>
33+
</ContentPage.Resources>
34+
1035
<StackLayout Margin="10">
1136
<CarouselView ItemsSource="{Binding Monkeys}"
1237
IndicatorView="indicatorView">
@@ -44,14 +69,17 @@
4469
</DataTemplate>
4570
</CarouselView.ItemTemplate>
4671
</CarouselView>
72+
4773
<IndicatorView x:Name="indicatorView"
4874
Margin="0,0,0,40"
49-
IndicatorColor="LightGray"
50-
SelectedIndicatorColor="Black"
75+
IndicatorColor="Transparent"
76+
SelectedIndicatorColor="Transparent"
5177
HorizontalOptions="Center">
5278
<IndicatorView.IndicatorTemplate>
5379
<DataTemplate>
54-
<Image Source="{FontImage &#xf30c;, FontFamily={OnPlatform iOS=Ionicons, Android=ionicons.ttf#}, Size=12}" />
80+
<Label Text="&#xf30c;"
81+
FontFamily="{OnPlatform iOS=Ionicons, Android=ionicons.ttf#}, Size=12}"
82+
Style="{StaticResource IndicatorLabelStyle}" />
5583
</DataTemplate>
5684
</IndicatorView.IndicatorTemplate>
5785
</IndicatorView>

0 commit comments

Comments
 (0)