コード例 #1
0
        /// <summary>
        /// Runs the ICommand when the requested RoutedEvent fires
        /// </summary>
        private void OnEventRaised(object sender, EventArgs e)
        {
            ICommand command = (ICommand)(sender as DependencyObject).
                               GetValue(SingleEventCommand.TheCommandToRunProperty);

            object commandParameter = (sender as DependencyObject).
                                      GetValue(SingleEventCommand.CommandParameterProperty);

            SCommandArgs commandArgs = new SCommandArgs(sender, e, commandParameter);

            if (command != null)
            {
                command.Execute(commandArgs);
            }
        }
コード例 #2
0
        /// <summary>
        /// Runs the ICommand when the requested RoutedEvent fires
        /// </summary>
        private void OnEventRaised(object sender, EventArgs e)
        {
            ICommand command = (ICommand)(sender as DependencyObject).
                GetValue(SingleEventCommand.TheCommandToRunProperty);

            object commandParameter = (sender as DependencyObject).
                GetValue(SingleEventCommand.CommandParameterProperty);

            SCommandArgs commandArgs = new SCommandArgs(sender, e, commandParameter);
            if (command != null)
                command.Execute(commandArgs);

        }