using System; using System.Windows.Input; namespace UWP.CartesianChart.Events { public class MyCommand : ICommand where T : class { public Predicate CanExecuteDelegate { get; set; } public Action ExecuteDelegate { get; set; } public bool CanExecute(object parameter) { return CanExecuteDelegate == null || CanExecuteDelegate((T) parameter); } public void Execute(object parameter) { if (ExecuteDelegate != null) ExecuteDelegate((T) parameter); } public event EventHandler CanExecuteChanged; } }