I have a TreeView showing an object’s properties. One of the properties is a large byte array.
TreeView’s ItemsSource obviously treats this as a collection of child nodes, but what I actually want is ONE child node showing the entire array that can still be expanded/collapsed.
eg currently
- MyObject
Prop1
Prop2
- PropWithBytes
1
2
3
etc
What I want:
- MyObject
Prop1
Prop2
- PropWithBytes
1, 2, 3 etc
Is there any way to tell the Tree to treat the collection as a single node?
If I didn’t want the actual data to still be a separate node I could easily write a DataTemplate (as opposed HierarchicalDataTemplate) to to display it in place. I can also use a DataTemplate that uses an Expander instead to hide the data which works fine, but looks ugly.
If I understand your question correctly – try to use ValueConverter which will check if passed value is byte array or not (in case of byte array – returns it’s string representation).