Hello,
I need several explanations please. :) I have a simple example code in MS VS 2019 C# with WPF - pattern MVVM:
There is the source code:
https://drive.google.com/file/d/1ea-K_BJYvED8S-87YxQZR4aiK0AJw2zP/view?usp=sharing
1/ The code had entry point in file "CommandDemo.xaml.cs".
2/ On row 26 is a command: "this.DataContext = new CommandDemoViewModel();" and this command creates the instance of the class "CommandDemoViewModel".
3/ If I try to debug whole the code step by step from the row 26 there is as the first launched the getter in the property "public ICommand ShowCommand" in the file "CommandDemoViewModel". After that the "RelayCommand" class is created and after the command "return showCommand;" of the getter the debugger jumps to the file "RelayCommand.cs" and the class "RellayCommand" and inside the class is called the "public event EventHandler CanExecuteChanged" and is added an event using command "add".
4/ Can someone very gently explain me WHO is caller of the ""public event EventHandler CanExecuteChanged: add" ?? is it done by an internal processes of the WPF ??? which are hidden from me ?
5/ Who/What is caller of the getter of the property "public ICommand ShowCommand" in class "CommandDemoViewModel" ??
6/ and to where is passed "the control" after the command "return showCommand;" in the "public ICommand ShowCommand" property ???
7/ Is it possible to omit the line "showCommand = new RelayCommand(a);" int the "public ICommand ShowCommand" property and move everything from the file "RelayCommand.cs" to the "public class CommandDemoViewModel : INotifyPropertyChanged" ???
8/ Is there some detailed manual "for dummies" of the internal processes of the WPF ? I would like to understand to it. :)
Jerry