I've created a hierarchical data structure using ObservableCollection<T> where each item contains a public ObservableCollection<T> to connect to the next node. The data structure is similar to the one in the DataUtil class which is in your DataTreeBinding example.
The problem is that only the root node gets displayed and I don't see an Expand Icon where I know there are sub-nodes in the data. What is the requirement in order to get the XamDataTree to recognize there are sub-nodes?
I'm binding in code like this:this.MyTree.DataContext = m_menuData;this.MyTree.ItemsSource = m_menuData.Centers;where m_menuData is the object that contains the data and m_menuData.Centersis the ObservableCollection<T> that contains the data hierarchy.
Hi,
Could you post the definition of your data structure?
It is important to define the NodeLayout before the XamDataTree can display the child levels. If layouts are defined in the GlobalNodeLayout collection, you need to make sure that the Key property corresponds to the property name that is of type ObservableCollection<T> and TargetTypeName is the string name of the type of the items (T).
HTH,
Thank you for your prompt response!
My actual data structure is way too much to post. If needed, I'll later try to create a simplified version that shows the essentials.
In regards to the GlobalNodeLayout (which I am using), I thought the Key property was an arbitrary name for the Node Layout provided just so the NodeLayout could be referenced in code. So, I didn't understand your comment "...make sure that the Key property corresponds to the property name that is of type ObservableCollection<T>". Could you please explain that further.
Regarding your comment "TargetTypeName is the string name of the type of the items (T)", I think herein my lay my problem. My instantiation of ObservableCollection<T> is actually ObservableCollection<TBaseClass> and in my NodeLayout definitions I'm referencing Derived classes with the TargetTypeName property. There's no way for me to know the type of a given node at design time.
Is there any way to make this work?
Thanks again,
Joe