How to instantiate DataContext object in XAML

后端 未结 4 1476
独厮守ぢ
独厮守ぢ 2020-12-29 03:46

I want to be able to create an instance of the DataContext object for my WPF StartupUri window in XAML, as opposed to creating it code and then setting the

4条回答
  •  灰色年华
    2020-12-29 03:56

    Assuming this code:

    public abstract class BaseView { }
    public class RuntimeView : BaseView { }
    public class DesigntimeView : BaseView { }
    

    Try this:

    
        
    
    
        
    
    
    

    Best of luck!

提交回复
热议问题