How to reference a generic type in the DataType attribute of a HierarchicalDataTemplate?
I have a class of MyClass<MyObject> and want to set it as the DataType for a HierarchicalDataTemplate. What is the syntax for this in XAML? (I know how to set namespaces, I need just the syntax for <HierarchicalDataTemplate DataType="{X:Type ..... Szymon Rozga itowlson's approach is a good one but it is just a start. Here's something that will work for your case (and most, if not all, cases): public class GenericType : MarkupExtension { public Type BaseType { get; set; } public Type[] InnerTypes { get; set; } public GenericType() { } public GenericType(Type baseType, params Type[] innerTypes)