This abstract class is a RoutedCommand which allows its subclasses to provide default logic for determining if they can execute and how to execute. To enable the default logic to be used, set the IsCommandSink attached property to true on the root element of the element tree which uses one or more SmartRoutedCommand subclasses.
Inheritance: System.Windows.Input.RoutedUICommand
示例#1
0
        /// <summary>
        /// Event handler, called when CanExecute changes.
        /// </summary>
        /// <param name="sender">the changing object</param>
        /// <param name="e">the event's arguments</param>
        private static void OnCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            SmartRoutedUICommand cmd = e.Command as SmartRoutedUICommand;

            if (cmd != null)
            {
                e.CanExecute = cmd.CanExecuteCore(e.Parameter);
            }
        }
示例#2
0
        /// <summary>
        /// Event handler, called when Executed changes.
        /// </summary>
        /// <param name="sender">the changing object</param>
        /// <param name="e">the event's arguments</param>
        private static void OnExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            SmartRoutedUICommand cmd = e.Command as SmartRoutedUICommand;

            if (cmd != null)
            {
                cmd.ExecuteCore(e.Parameter);
                e.Handled = true;
            }
        }