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 CyberX8_MainPages.Sequence { public class EventToCommand : TriggerAction { 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); } } } }