What is the advantage of setting DataContext in code instead of XAML?

后端 未结 7 1300
小鲜肉
小鲜肉 2020-12-09 10:54

There seem to be two main ways to define DataContext in WPF:

  • either in code like this:

App.xaml.cs (taken from the WPF MVVM Too

7条回答
提交回复
热议问题