【发布时间】:2014-04-07 05:05:31
【问题描述】:
我的视图模型中需要 FolderBrowserDialog 的结果,
CodeBehind.cs
private static void SelectFolderDialog()
{
using (System.Windows.Forms.FolderBrowserDialog folderdialg = new System.Windows.Forms.FolderBrowserDialog())
{
folderdialg.ShowNewFolderButton = false;
folderdialg.RootFolder = Environment.SpecialFolder.MyComputer;
folderdialg.Description = "Load Images for the Game";
folderdialg.ShowDialog();
if (folderdialg.SelectedPath != null)
{
var notifypath = new GenericMessage<string>(folderdialg.SelectedPath);
Messenger.Default.Send(notifypath);
}
}
我的计划是,从 View-model 发送带有回调的通知到 view ,执行 FolderBrowserDialog 将选定的路径返回给视图模型。
如何使用 MVVM-Light 发送带有回调 / NotificationWithAction 的通知消息。请帮我提供一个示例,因为我是 Wpf 和 MVVM-Light 的新手。
任何帮助表示赞赏
【问题讨论】:
标签: c# wpf mvvm mvvm-light