<DataTemplate x:Key="MyTemplate" DataType="{x:Type l:MyViewModel}">
<l:MyView />
</DataTemplate>
Is there any way I can replace the “MyTemplate” with a value from a class of mine?
public sealed class MyTemplateSelector : DataTemplateSelector
{
public const string TemplateName = "MyTemplate";
//I use the TemplateName const to retrieve the correct DataTemplate
}
how about leaving that x:Key and it will be default DataTemplate for your l:ViewModel type ?
not sure if you can Bind/link your key to certain properties