Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想为两个视图共享一个 ViewModel。在我创建的 App.xaml.cs
public static MyViewMode ViewModel { get; set; }
第一视角:
App.ViewModel = new MyViewModel(); this.DataContext = App.ViewModel;
第二种观点:
this.DataContext = App.ViewModel;
当我想共享 ViewModel 时,这是个好方法吗?非常感谢。