我有一个ListView IsGroupedSource设置为true,在它的CollectionViewSource。 我想点击它的组头切换时,一个群体的知名度。
<CollectionViewSource
x:Name="FiltersViewSource"
Source="{Binding Filters}"
IsSourceGrouped="true"
ItemsPath="AttributeValues"
/>
<ListView
x:Name="filtersListView"
AutomationProperties.AutomationId="ItemListView"
AutomationProperties.Name="Grouped Items"
Grid.Row="1"
Margin="0,-10,0,0"
Padding="30"
ItemsSource="{Binding Source={StaticResource FiltersViewSource}}"
SelectionMode="None"
IsSwipeEnabled="false"
IsItemClickEnabled="True"
ItemClick="ItemView_ItemClick">
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<Grid Margin="7,7,0,0">
<Button AutomationProperties.Name="Group Title"
Click="Header_Click"
Style="{StaticResource TextPrimaryButtonStyle}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" Foreground="White" FontSize="35" Margin="3,-7,10,10" Style="{StaticResource GroupHeaderTextStyle}" />
<TextBlock Text="{StaticResource ChevronGlyph}" Foreground="White" HorizontalAlignment="Right" FontFamily="Segoe UI Symbol" Margin="0,-7,0,10" Style="{StaticResource GroupHeaderTextStyle}"/>
</StackPanel>
</Button>
</Grid>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.Panel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid Orientation="Vertical" Margin="0,0,0,0"/>
</ItemsPanelTemplate>
</GroupStyle.Panel>
</GroupStyle>
</ListView.GroupStyle>
<ListView.ItemTemplate>
<DataTemplate >
<StackPanel Visibility="{Binding Visibility}" Orientation="Horizontal">
<CheckBox Margin="0,0,20,0"/>
<TextBlock Text="{Binding Name}" Style="{StaticResource ItemTextStyle}" Foreground="White" FontSize="20" MaxHeight="40"/>
<TextBlock Text="(40)" Style="{StaticResource ItemTextStyle}" Foreground="White" FontSize="25" MaxHeight="40"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
基本上我想要创建一个手风琴样式列表。 我尝试添加。
<VariableSizedWrapGrid Visibility="{Binding Visibility}" Orientation="Vertical" Margin="0,0,0,0"/>
Visbility是类型能见度的底层组对象中的属性。
但是,这是行不通的。
反正有没有做到这一点?