mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-07 10:10:49 +08:00
23 lines
618 B
C#
23 lines
618 B
C#
using System;
|
|
using System.Windows.Input;
|
|
|
|
namespace UWP.CartesianChart.Events
|
|
{
|
|
public class MyCommand<T> : ICommand where T : class
|
|
{
|
|
public Predicate<T> CanExecuteDelegate { get; set; }
|
|
public Action<T> 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;
|
|
}
|
|
} |