How to reference a generic type in the DataType attribute of a DataTemplate?

后端 未结 8 1445
深忆病人
深忆病人 2020-12-18 18:19

I have a ViewModel defined like this:

public class LocationTreeViewModel : 
    ObservableCollection, INotifyPropertyChanged
               


        
8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-18 19:12

    No, you cannot express a generics type in XAML. You will have to create a concrete type that extends your generic one ...

    public class FooLocationTreeViewModel : LocationTreeViewModel
    {
    }
    

提交回复
热议问题