Access nested items in CollectionViewGroup
So i am trying to access some nested items in a CollectionView then bind them to a ListBox. Is there a simple way to do this? At the moment my ListBox is binding to "ContactListName" which is the immediate item but I would like to bind to "LabelName" which is开发者_开发技巧 a nested item of ContactList. Thanks - Ben
try setting DisplayMemberPath for ListBox
tagsList.ItemsSource = contactsList.SelectedItems;
tagsList.DisplayMemberPath = "LabelName";
if you are using ItemTemplate You need to set Binding
<DataTemplate x:Key="TagsTemplate">
<WrapPanel>
<TextBlock Text="{Binding LabelName, Mode=Default}" TextWrapping="Wrap" FontSize="{Binding ItemCount, Converter={StaticResource CountToFontSizeConverter}, Mode=Default}" Foreground="#FF0D0AF7"/>
</WrapPanel>
</DataTemplate>
精彩评论