Пример #1
0
        /// <summary>
        /// Shows a dialog window (with Ok/Cancel buttons and validation display) containing the object passed
        /// </summary>
        /// <param name="vm">The object to show. e.g. the ViewModel</param>
        /// <returns></returns>
        public bool ShowDialogView(IDialog vm)
        {
            DialogContainer dc = new DialogContainer();
            ContainerWindow w  = new ContainerWindow();

            w.Owner       = _wpfWindow;
            w.DataContext = vm;
            w.Content     = dc;
            w.CommandBindings.Add(new CommandBinding(vm.DialogAcceptCommand, (sender, e) =>
            {
                vm.DialogOkClicked();
                w.DialogResult = true;
            }));
            return(w.ShowDialog().GetValueOrDefault(false));
        }
Пример #2
0
 /// <summary>
 /// Shows a dialog window (with Ok/Cancel buttons and validation display) containing the object passed
 /// </summary>
 /// <param name="vm">The object to show. e.g. the ViewModel</param>
 /// <returns></returns>
 public bool ShowDialogView(IDialog vm)
 {
     DialogContainer dc = new DialogContainer();
     ContainerWindow w = new ContainerWindow();
     w.Owner = _wpfWindow;
     w.DataContext = vm;
     w.Content = dc;
     w.CommandBindings.Add(new CommandBinding(vm.DialogAcceptCommand, (sender, e) =>
     {
         vm.DialogOkClicked();
         w.DialogResult = true;
     }));
     return w.ShowDialog().GetValueOrDefault(false);
 }