在我的WPF應用程序中,我有一個CollectionViewSource,它提供了一個私有的ObservableCollection視圖。 CollectionViewSource有一個PropertyGroupDescription,它被用在ListBox中以向用戶的偏好提供數據。CollectionViewSource + PropertyGroupDescription - 組中的項數
在ListBox GroupStyle中使用包含Expander Control的ControlTemplate,結果非常好。但是,除了組名以外,我還想在擴展頭中顯示每個組的項目數。關於綁定路徑的任何想法?
問候, 利亞姆
<Style x:Key="basicGroupStyle" TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander Header="{Binding Name}" IsExpanded="True">
<ItemsPresenter/>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ListBox ItemsSource="{Binding Source={StaticResource myViewSource}}">
<ListBox.GroupStyle>
<GroupStyle ContainerStyle="{StaticResource basicGroupStyle}"/>
</ListBox.GroupStyle>
</ListBox>
我不知道我是如何錯過在MSDN文檔。非常感謝。 – LiamV 2010-11-01 11:37:56