Search code examples
c#wpfinotifypropertychangedwpftoolkitwizard

implementing INotifyPropertyChanged


I am trying to make a wizard in wpf using the wpf toolkit extended wizard control.

I need to prevent the user from proceeding to the next page unless certain conditions are met.

This answer to another question suggested binding the CanSelectNextPage property to a boolean property in the code behind the current page.

I am having trouble implementing INotifyPropertyChanged. In the answer linked above, his MainWindow class extends INotifyPropertyChanged. How is that possible? Wouldn't the MainWindow class have to extend the Window class?

Also, what assembly is INotifyPropertyChanged located in? MSDN says it is in System.ObjectModel.dll which I don't seem to have...


Solution

  • His MainWindow class implements INotifyPropertyChanged, which is found in System.ComponentModel.

    This MSDN article should explain how to use it: https://msdn.microsoft.com/en-us/library/vstudio/system.componentmodel.inotifypropertychanged(v=vs.100).aspx

    INotifyPropertyChanged will notify clients, such as your UI, when a given property changes. You could bind the visibility of your 'next' button to a boolean property of your class, and set the boolean property to true once all of your other properties are set.

    EDIT: I should add that in order to bind a boolean value to the visibility of a button, you'll need to use an IValueConverter.