コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UndoCommandBinding&lt;TController, TModel&gt;"/> class.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        public UndoCommandBinding(ViewModel <TController, TModel> viewModel)
        {
            this.Command = ApplicationCommands.Undo;

            this.CanExecute += delegate(object sender, CanExecuteRoutedEventArgs e)
            {
                e.CanExecute = UndoCommand <TController, TModel> .CanExecute(viewModel, e.Parameter);
            };

            this.Executed += delegate(object sender, ExecutedRoutedEventArgs e)
            {
                UndoCommand <TController, TModel> .Execute(viewModel, e.Parameter);
            };
        }
コード例 #2
0
 internal static void Execute(ViewModel <TController, TModel> viewModel, object parameter)
 {
     UndoCommand <TController, TModel> .Undo(viewModel);
 }
コード例 #3
0
 internal static bool CanExecute(ViewModel <TController, TModel> viewModel, object parameter)
 {
     return(UndoCommand <TController, TModel> .CanUndo(viewModel));
 }