vue-java-tutorials/CSharp/WPFTutorial/WPF-13-INotifyPropertyChanged/Command/ShowCommand.cs

25 lines
476 B
C#
Raw Normal View History

2025-06-22 20:21:42 +08:00
using System.Windows.Input;
namespace WPF_13_INotifyPropertyChanged.Command;
public class ShowCommand : ICommand
{
private readonly Action _executeAction;
public ShowCommand(Action executeAction)
{
_executeAction = executeAction;
}
public bool CanExecute(object? parameter)
{
return true;
}
public void Execute(object? parameter)
{
_executeAction();
}
public event EventHandler? CanExecuteChanged;
}