Your preferred RelayCommand implementation
Posted: 24 Dec 2020, 09:29
I'm still new to WPF and have been surprised to hear about the peculiar culture of it. In this case, I'm talking about the various ways people implement some things for it that are surprisingly not included in a default way like RelayCommand.
I was dabbling in Visual Studio with a project first, and I started using this RelayCommand:
https://www.c-sharpcorner.com/UploadFil ... nd-in-wpf/
I have a lot of buttons and use that RelayCommand to bind commands to run when the buttons are pressed.
The problem with integrating with NoesisGUI comes down to CommandManager in the CanExecuteChanged handler:
This isn't found when building in Unity. What I gathered from other posts on here is that Noesis has something like CommandManager but doesn't expose it. For what it's worth, I can stub out the handlers and just have them do nothing. It seems to not harm my project, but I suspect it harms some optimizations. Other people have their own RelayCommands they rely on so I just figured I'd ask what you are using instead.
I was dabbling in Visual Studio with a project first, and I started using this RelayCommand:
https://www.c-sharpcorner.com/UploadFil ... nd-in-wpf/
I have a lot of buttons and use that RelayCommand to bind commands to run when the buttons are pressed.
The problem with integrating with NoesisGUI comes down to CommandManager in the CanExecuteChanged handler:
Code: Select all
public event System.EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}