Skip to Content
Mastering Windows Presentation Foundation
book

Mastering Windows Presentation Foundation

by Sheridan Yuen
February 2017
Intermediate to advanced
568 pages
14h 19m
English
Packt Publishing
Content preview from Mastering Windows Presentation Foundation

Encapsulating common functionality

Probably the most commonly used interface in any WPF application would be the INotifyPropertyChanged interface, as it is required to correctly implement data binding. By providing an implementation of this interface in our base class, we can avoid having to repeatedly implement it in every single View Model class. It is therefore, a great candidate for inclusion in our base class. There are a number of different ways to implement it depending on our requirements, so let's take a look at the most basic first:

public virtual event PropertyChangedEventHandler PropertyChanged; protected virtual void NotifyPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Windows Presentation Foundation - Second Edition

Mastering Windows Presentation Foundation - Second Edition

Sheridan Yuen

Publisher Resources

ISBN: 9781785883002Supplemental Content