We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Platform : WPF
Category : DataBinding

How do I specify a HierarchicalDataTemplate for a templated type?

Sometimes you might have to specify a HierarchicalDataTemplate for a templated type. If so, you can only do this in code-behind. (If you have to do this in XAML try wrapping that template type within a non-templated dummy type.) For example, if you have to do something like this: The above wouldn’t compile because the XAML compiler doesn’t support this.

So, you will have to do this in code-behind instead: Note that the above code also illustrates how to add a HierarchicalDataTemplate resource to the Resources list without specifying a key.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.