Q: Can someone very gently explain me WHO is caller of the ""public event EventHandler CanExecuteChanged: add" ?
A: A C# event has an add
and a remove
method (similar to a property's get and set methods). The CanExecuteChanged
occurs when changes occur that affect whether or not the command should execute, and also notifies any command sources that are bound to that ICommand that the value returned by CanExecute has changed.
Q: Who/What is caller of the getter of the property "public ICommand ShowCommand" in class "CommandDemoViewModel" ?
A: You Bind ShowCommand
to your Button Command
( <Button x:Name="btnShow" Content="Show" Command="{Binding ShowCommand}" HorizontalAlignment="Left" Margin="20" VerticalAlignment="Top" Width="100"/>
), ButtonBase.Command Property gets or sets the command to invoke when this button is pressed
.
Q: to where is passed "the control" after the command "return showCommand;" in the "public ICommand ShowCommand" property ?
A: It should invoke the Command Set method for your Button.
Q: Is it possible to omit the line "showCommand = new RelayCommand(a);" ...
A: You should not omit showCommand = new RelayCommand(a);
, if you omit in your project, the ShowCommand
will not invoke CanExecute
and Execute
.
Q: Is there some detailed manual "for dummies" of the internal processes of the WPF ? I would like to understand to it. :)
A: There is a documentation on UWP MVVM that you can use to understand the WPF MVVM schema.
Do my answer give you help? If they don't, please let me know and give me more detailed description of your questions.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.