大家好,我正在努力解决在 Catel MVVM 模型中的视图模型之间发送数据的过程。我有一个按钮,单击它我想打开一个新窗口并将一些数据(对象)发送到新打开的窗口。但是我自己无法解决这个问题,你能帮帮我吗?
在我的第一个视图模型中,我有:
private readonly IShowStopInfo stopInfo;
//Main constructor of the class
public StopViewModel(IGrtrService grtrService, IShowStopInfo stopInfo)
{
this.stopInfo = stopInfo;
Argument.IsNotNull(() => grtrService);
_grtrService = grtrService;
AllStops = _grtrService.LoadStop();
Stop_Line = _grtrService.LoadLines();
ShowSelectedValue = new Command(OnStopsInfo);
}
public Command ShowSelectedValue { get; private set; }
private void OnStopsInfo()
{
stopInfo.ShowStopInfo();
}
//Getting Selected Stop from the list
public Stop SelectedStop
{
get { return GetValue<Stop>(SelectedStopProperty); }
set { SetValue(SelectedStopProperty, value); }
}
public static readonly PropertyData SelectedStopProperty = RegisterProperty("SelectedStop", typeof(Stop));
就我而言,我想从“SelectedStop”方法发送结果,我该怎么做?