【发布时间】:2014-08-28 11:27:05
【问题描述】:
大家好,我正在努力解决在 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”方法发送结果,我该怎么做?
【问题讨论】:
-
请务必标记之前问题的答案,例如stackoverflow.com/questions/25280047/…
-
这如何回答我的问题?
-
它有助于让人们有动力回答你的问题,所以这样肯定会有所帮助;-)