Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Binding xamTreeGrid to a list of key/value objects
posted

Hi,

I am trying to create a categorized view that I want to represent here as a simple category/list of object names. I was able to do it using the TreeView but I am having troubles doing the same using the xamTreeGrid, which I need to use. Any help would be greatly appreciated!

the view model is:

List<KeyValuePair<string, List<BaseObject>>> ListOfCatObjects

using a regular TreeView:

 <TreeView Name="treeViewCategorized" ItemsSource="{Binding ListOfCatObjects}" >

<TreeView.ItemTemplate>

<HierarchicalDataTemplate ItemsSource="{Binding Path=Value}">

<TextBlock Text="{Binding Path=Key}" />

<HierarchicalDataTemplate.ItemTemplate>

<DataTemplate>

<TextBlock Text="{Binding Name}"/>

</DataTemplate>

</HierarchicalDataTemplate.ItemTemplate>

</HierarchicalDataTemplate>

</TreeView.ItemTemplate>

<TreeView.ItemContainerStyle>

<Style TargetType="{x:Type TreeViewItem}">

<Setter Property="IsSelected" Value="{Binding IsSelected}" />

</Style>

</TreeView.ItemContainerStyle>

</TreeView>

Thanks in advance,

Maria



Parents Reply Children
No Data