我在另一个ViewModel
(排序)中有一个ViewModel
(排序图)。我想在排序中使用ComboBox
来选择在SortingChart中使用的金额。如何从另一个ViewModel
代码隐藏排序:
public class vmSorting : VMBase
{
//The ComboBox I want to use in the other vm.
private ComboBox _SelectTop;
public ComboBox SelectTop
{
get { return _SelectTop; }
set { _SelectTop = value; NotifyPropertyChanged(); }
}
//The content in which the (SortingChart) is loaded.
private object _MyContent;
public object MyContent
{
get { return _MyContent; }
set { _MyContent = value; NotifyPropertyChanged(); }
}
//For the Update button.
private RelayCommand _cmdUpdate;
public ICommand Update
{
get
{
if (_cmdUpdate == null)
_cmdUpdate = new RelayCommand(param => this.Button_Click_Update(param));
return _cmdUpdate;
}
}
private void Button_Click_Update(object sender)
{
if (sender as string == "UpdateChart")
MyContent = new AlarmsTopSortingChart();
}
}
代码行为排序表:
public class vmSortingChart : VMBase
{
//Here I want to use the selecteditem from the combobox in (Sorting)
}