How Can I bind DataContext to a Generic ViewModel in XAML?

前端 未结 4 1805
夕颜
夕颜 2021-02-20 09:17

Suppose we have a generic View model like this:

public class MyViewModel : INotifyPropertyChanged where T : Class1
{
    private T _objectModel;
    pub         


        
4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-20 10:00

    You could create a class that inherits from your generic ViewModel and use that

    public class PersonViewModel : ViewModel
    

    XAML:

    
        
    
    

提交回复
热议问题