I have no idea what to call this, so it may have already been addressed numerous times.
I have a wrapper class for a collection:public class TreeCategory<T> : IEnumerable<T>
In my xaml
I am using the class in the HierarchicalDataTemplate
as follows:
<HierarchicalDataTemplate x:Key="m_CategoryTemplate"
DataType="{x:Type local:TreeCategory`1}" <--- WHAT IS THIS?!
ItemsSource="{Binding CategoryCollection}" >
<TextBox Text="{Binding CategoryName}" />
</HierarchicalDataTemplate>
So my question is, when I build using local:TreeCategory
the build fails, as the project complains it does not know what the class TreeCategory
is. However if I use:
TreeCategory`1
then the project builds fine.
What is the `1, why is it necessary?
http://msdn.microsoft.com/en-us/library/system.codedom.codetypereference.basetype.aspx
Generic types are formatted with the name of the type followed by a grave accent ("`") followed by a count of the generic type arguments.
So by removing the `1
you're actually saying the type is TreeCategory
and not TreeCategory<T>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With