选中时,将TabItems中的集合绑定到单个DataGrid

时间:2015-04-08 08:25:27

标签: c# wpf mvvm datagrid tabcontrol

我有一个带有TabControl的Window,其中包含两个TabItem,每个TabItem包含一个UserControl。这些视图模型继承自包含ObservableCollection属性的BaseViewModel。

在TabControl下,我有一个DataGrid; Window的viewmodel包含与BaseViewModel相同的ObservableCollection属性,DataGridView绑定到它。

如何直接或不将选定的viewmodel集合绑定到DataGrid(例如MyWindow.MyCollection = selectedVM.MyCollection)?

我们的想法是更新DataGrid以始终显示所选标签集合的内容。

0 个答案:

没有答案