-
I am making a TreeView, and when creating the DataTemplate i have to assign the DataType Property. Code: namespace MyAvaloniaApp
{
public interface IMyInterface
{
string Name { get; set; }
}
} XAML: <TreeDataTemplate DataType="MyAvaloniaApp.IMyInterface">
</TreeDataTemplate> Could someone give an explanation of how to assign a Type in xaml, or link to documentation about this (I couldn't find any) |
Beta Was this translation helpful? Give feedback.
Answered by
maxkatz6
Mar 21, 2021
Replies: 1 comment
-
You need to define namespace: <TreeDataTemplate xmlns:namespace="using:MyAvaloniaApp"
DataType="namespace:IMyInterface">
</TreeDataTemplate> Or WPF style: <TreeDataTemplate xmlns:namespace="clr-namespace:MyAvaloniaApp;assembly=MyAssemblyName"
DataType="namespace:IMyInterface">
</TreeDataTemplate> This "xmlns" part is usually set on the root element of xml/xaml file. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Sarund9
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to define namespace:
Or WPF style:
This "xmlns" part is usually set on the root element of xml/xaml file.