Trying to understand INotifyPropertyChanged

后端 未结 4 1994
清歌不尽
清歌不尽 2021-01-25 04:25

Several (newbie) questions:

1) I see a lot of

public Person SelectedPerson { get; set; } 

I am assuming this does NOT fire a property

4条回答
  •  遇见更好的自我
    2021-01-25 04:39

    Here's a link to a good article introducing the MVVM pattern.

    Specifically, if you look at the RelayCommand class, it does a nice job of implementing an ICommand object and allowing you to specify a predicate to evaluate whether or not the Command may be executed.

    The evaluation of the canExecute predicate in the RelayCommand saves you from binding a separate property to the IsEnabled property of the Button.

    I typically follow the example in the article of implementing a private property which supplies the Boolean value for the canExecute predicate.

    That article was a good help to me to get started with the pattern.

提交回复
热议问题