Chapter 6. Implementing WPF's new features

In this chapter we will cover:

  • Implementing asynchronous error handling with INotifyDataErrorInfo
  • Using the WeakEvent pattern with WeakEventManager
  • Using the dispatcher's new features
  • Data binding to static properties
  • Throttling the data source update delays
  • LiveShaping — repositioning elements when bound data changes

Introduction

WPF has been enhanced in .NET 4.5, including new and improved controls, such as the ribbon, better data validation, and the INotifyDataErrorInfo interface, to get into the world of asynchronous data validation. The main new features of .NET 4.5 are as follows:

  • Improved performance for displaying large sets of data.
  • Improvements in data binding, which involves binding to static properties, custom types (ICustomTypeProvider), reacting when the data context is disconnected, and introducing timeouts for property changes. We can also obtain the data binding information for a binding expression.
  • Data source update delays help us configure a delay to update a data source from the UI, which can be very useful to improve our application's performance.
  • Better weak-event pattern support, now accepting markup extensions.
  • LiveShaping or repositioning of data as the values change.
  • Accessing collections on the UI threads.

In the following sections, we will cover and explain some of the most relevant changes, improvements, and actions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset