WPF 4.0 has a great change to the data binding pipeline that me and others have been patiently waiting for. Many thanks to the WPF Team for implementing this feature.
Properties are now automatically reread from the binding source after the UI controls set the property value.
This feature enables the business entity objects to modify the value coming from the UI and have that value automatically reflected back to the UI.
A classic example of this feature in action would be a state field.
- User enters wa in a TextBox
- State property on the business object is updated to wa
- Business rules change the case of the entered value to upper case setting the value to WA
- Data binding pipeline now automatically rereads the State property value and sets the TextBox.Text to WA
Before this great feature, developers could implement a workaround by adding a no-op converter to each TextBox binding.
You can read about the issue that still exists in .NET 3.0 and .NET 3.5 projects here.
This feature is not dependent on the business object implementing the INotifyPropertyChanged interface.
Simple Business Object Code
Public Property State As String Get Return _strState End Get Set(ByVal value As String) _strState = value If Not String.IsNullOrEmpty(_strState) Then _strState = _strState.ToUpper End If OnPropertyChanged("State") End Set End Property
State Field Runtime Behavior Demonstrated
Email Field Runtime Behavior Demonstrated
The Email property business rules will change the TextBox value to lower case.
Download – Requires Visual Studio 2010 Beta1 or later
After downloading the project, please change the extension from .doc to .zip. This is a requirement of WordPress.com.
Have a great day,
Just a grain of sand on the worlds beaches.