One WPF feature that is not covered a lot is the HeirarchicalDataTemplate and hence, I asked my intern, Ahmad El-Shafey, to try something on this feature. And yeah, he did write a blog post on it :) ... this is his post on his experience with HeirarchicalData templates. " Some people use DataTemplates and/or HierarchicalDataTemplates to bind MenuItem content to a data source, like this: < HierarchicalDataTemplate DataType ="Menu" ItemsSource ="{ Binding XPath =*}"> < TextBlock Header ="{ Binding XPath = @ Name}"/> </ HierarchicalDataTemplate > I wasn’t so comfortable with this because you are creating a TextBlock element inside the items of our MenuItem, and binding its Text property to the data source. What we really want to do is bind the Header element of the MenuItems to the data source, without creating more elements. What we need to do is create a Style and bind it to our data source, and then set this Style as the ItemContainerStyle of our MenuItem. Let’s say we
Read More...