Working with CLR properties and UI notifications
The CLR properties are just a wrapper around the private variables to expose getters and setters to retrieve and assign the value of a variable. You can use these normal CLR properties in data binding, but the automatic UI notifications are not possible by default, unless you create the notification mechanism.
In this recipe, we will learn how to perform data binding with CLR properties and then learn how to trigger notifications from the code to automatically update the UI when the value changes.
Getting ready
To get started with data binding with normal CLR properties, open your Visual Studio IDE and create a new WPF application project called CH04.NotificationPropertiesDemo
.
How to do it...
Perform the following steps to create CLR properties that send notifications to the UI:
- Open the
MainWindow.xaml
file and give the window a name. For example, name the current windowwindow
by adding the following syntax to theWindow
tag:x:Name="window...