-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListViewPage.xaml
67 lines (62 loc) · 2.69 KB
/
ListViewPage.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?xml version="1.0" encoding="utf-8"?>
<Page
x:Class="ListViewGroups.ListViewPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ListViewGroups"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<DataTemplate x:Key="ListItemTemplate" x:DataType="local:ListItem">
<Grid Margin="10,10,10,10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1"
Text="{x:Bind Name}"
x:Phase="1"
Style="{ThemeResource SubtitleTextBlockStyle}"
Margin="12,6,0,0"/>
</Grid>
</DataTemplate>
<CollectionViewSource x:Name="MyCollectionViewSource" Source="{x:Bind MyGroups}" ItemsPath="MyItems" IsSourceGrouped="True"/>
</ResourceDictionary>
</Page.Resources>
<StackPanel>
<ListView
ItemsSource="{x:Bind MyCollectionViewSource.View, Mode=OneWay}"
x:Name="MyListView"
ItemTemplate="{StaticResource ListItemTemplate}"
Grid.Row="1"
Margin="36,24,36,24"
BorderThickness="1"
BorderBrush="{ThemeResource SystemControlForegroundBaseLowBrush}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel AreStickyGroupHeadersEnabled="True"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.GroupStyle>
<GroupStyle >
<GroupStyle.HeaderTemplate>
<DataTemplate x:DataType="local:GroupSection">
<Border>
<TextBlock Text="{x:Bind Key}" Style="{ThemeResource SubtitleTextBlockStyle}"/>
</Border>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ListView.GroupStyle>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListView.ItemContainerStyle>
</ListView>
</StackPanel>
</Page>