I’m trying to build a template for a treeView in WPF and c#. My problem is that i want to apply a different template for each items level.
I mean that the first item level will be looking different from the second level items.
I don’t know how to do this with templates and binding, as i’m new to the technology.
I’m also trying to add buttons to a certain treeviewItems level so i can fire events or commands…
i know this is much to ask, but i hope some one will give me a clue about this or at least if it is possible or not.
Thanks.
I’m trying to build a template for a treeView in WPF and c#. My
Share
Assuming all objects are of the same type, I can see two methods for achieving this would be to use either the ItemTemplate, or the ItemTemplateSelector properties.
Personally I prefer the XAML approach which would be to use the ItemTemplate property.
In the Template you would specify triggers to alter the appearance based on the level the item is sitting at. To obtain this level, you could specify a converter similar to this: