标签:direction dir tde display spl str block font name
Products =
new
ObservableCollection<Product>(products);
ProductOptions =
new
ObservableCollection<ProductOption>(options);
ProductsView = CollectionViewSource.GetDefaultView(Products);
ProductsView.GroupDescriptions.Add(
new
PropertyGroupDescription(
"Group"
));
ProductsView.SortDescriptions.Add(
new
SortDescription(
"Name"
, ListSortDirection.Ascending));
ProductOptionsView = CollectionViewSource.GetDefaultView(ProductOptions);
ProductOptionsView.SortDescriptions.Add(
new
SortDescription(
"Option"
, ListSortDirection.Ascending));
<ListBox Grid.Row="1" ItemsSource="{Binding Products}"
DisplayMemberPath="Name">
<ListBox.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock Foreground="DarkGreen" Text="{Binding Name}"
FontStyle="Italic"/>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ListBox.GroupStyle>
[Wpf]在C#中添加 collectionViewSource
标签:direction dir tde display spl str block font name
原文地址:https://www.cnblogs.com/nocanstillbb/p/11253623.html