Ghost1372

everything can be handy

ListViewExtension

AlternateColor

1
2
3
<ListView
wuc:ListViewExtensions.AlternateColor="Silver"
ItemsSource="{x:Bind MainViewModel.Items, Mode=OneWay}" />
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<Page.Resources>
<DataTemplate x:Name="NormalTemplate">
<TextBlock Text="{Binding " Foreground="Green"></TextBlock>
</DataTemplate>

<DataTemplate x:Name="AlternateTemplate">
<TextBlock Text="{Binding}" Foreground="Orange"></TextBlock>
</DataTemplate>
</Page.Resources>

<ListView
ItemTemplate="{StaticResource NormalTemplate}"
wuc:ListViewExtensions.AlternateItemTemplate="{StaticResource AlternateTemplate}"
ItemsSource="{x:Bind MainViewModel.Items, Mode=OneWay}" />

AlternateItem

Command

1
2
3
4
5
<ListView
wuc:ListViewExtensions.Command="{x:Bind MainViewModel.ItemSelectedCommand, Mode=OneWay}"
IsItemClickEnabled="True"
ItemsSource="{x:Bind MainViewModel.Items, Mode=OneWay}"
SelectionMode="None" />

DeselectItem

DeselectAll

SelectAllSafe

SmoothScrollIntoView

1
2
await listView.SmoothScrollIntoViewWithIndexAsync(listView.SelectedIndex, ScrollItemPlacement.Center, false, true);

Demo

you can run demo and see this feature.

0%