| 1234567891011121314151617181920212223242526272829303132 | using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Input;using System.Windows.Interactivity;namespace PunkHPX8_MainPages.Sequence{    public class EventToCommand : TriggerAction<DependencyObject>    {        public ICommand Command        {            get { return (ICommand)GetValue(CommandProperty); }            set { SetValue(CommandProperty, value); }        }        public static readonly DependencyProperty CommandProperty =            DependencyProperty.Register("Command", typeof(ICommand), typeof(EventToCommand), new PropertyMetadata(null));        protected override void Invoke(object parameter)        {            if (Command != null                && Command.CanExecute(parameter))            {                Command.Execute(parameter);            }        }    }}
 |