https://github.com/michalkuracina/icommand
Interface example
https://github.com/michalkuracina/icommand
csharp icommand wpf
Last synced: 3 months ago
JSON representation
Interface example
- Host: GitHub
- URL: https://github.com/michalkuracina/icommand
- Owner: MichalKuracina
- Created: 2021-12-06T15:24:11.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-06T15:26:58.000Z (over 4 years ago)
- Last Synced: 2025-03-02T03:41:23.333Z (over 1 year ago)
- Topics: csharp, icommand, wpf
- Language: C#
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ICommand
Solution demonstrates how ICommand interface works in WPF.
```cs
using System;
using System.Windows.Input;
namespace wpf_icommand.ViewModels.Commands
{
public class MessageCommand : ICommand
{
public event EventHandler CanExecuteChanged;
private Action _execute;
public MessageCommand(Action execute)
{
_execute = execute;
}
public bool CanExecute(object parameter)
{
return true;
}
public void Execute(object parameter)
{
_execute.Invoke();
}
}
}
```
Link to documentation -> [docs.microsoft.com](https://docs.microsoft.com/en-us/dotnet/api/system.windows.input.icommand?view=net-6.0)