Question about ViewModel Management (DesignTime Vs Run Time)

前端 未结 3 1016
庸人自扰
庸人自扰 2020-12-31 13:42

I have a fairly basic WPF UI whereby user requests cause a new tab to open in my TabControl. The TabControl is bound to an ObservableCollection

3条回答
  •  清酒与你
    2020-12-31 14:32

    There is an easier way to do this. Have a DesignTimeUserAdministrationViewModel and populate it with static data in the constructor and refer that in UserControl as:

    
    

    This way you have a design time test data bound to d:DataContext and runtime live data bound to the actual DataContext. More details here.

提交回复
热议问题