What Is New In WPF 4.5

DevToolsGuy / Wednesday, January 16, 2013

As you may be aware, WPF 4.5 was released sometime back. Just as every other product or technology that undergoes a version update, WPF also brings a number of new/enhanced features to the table.

Download WPF Controls Now!Let’s take a look at what these features are:

Better performance during display of  large collections of grouped data

The standard layout system in WPF creates item containers and determines layout for each item that is associated with a list control. Virtualizing comprises a technique through which a portion of UI elements are created from a larger number of data items based on items visible on the screen. Virtualizing is intensive, both in terms of memory and processor, to generate a large number of UI elements when only a few may be on the screen at a given time. UI virtualization improves the performance when displaying large collections of grouped data.
The VirtualizingPanel.IsVirtualizingWhenGrouping attached property retrieves or assigns a value indicating whether virtualization will take place or not, while displaying large number of items in groups.

Binding to static properties

In WPF 4.5, you can use static properties as the source of a data binding. The data binding engine recognizes when the property's value changes if a static event is raised.

Automatically updating the source of a data binding

If you use a data binding to update a data source, you can use the Delay property to specify an amount of time to pass after the property changes on the target before the source updates. For example, suppose that you have a Slider that has its Value property data two-way bound to a property of a data object and the UpdateSourceTrigger property is set to PropertyChanged. In this example, when the user moves the Slider, the source updates for each pixel that the Slider moves. The source object typically needs the Value of the slider only when the slider's Value stops changing. To prevent updating the source too often, use Delay to specify that the source should not be updated until a certain amount of time elapses after the thumb stops moving.

Binding to types that Implement ICustomTypeProvider

WPF 4.5 enables you to data bind to objects that implement ICustomTypeProvider, that is, custom types. Some of cases where you can use custom types are:

  • As the value of the DataType property.
  • As a PropertyPath in a data binding.

Retrieving data binding information from a binding expression

WPF 4.5 includes new APIs that provide support to retrieve the source or target object or the associated property that has a binding expression.

Ribbon control

WPF 4.5 includes a Ribbon control that can host a Quick Access Toolbar, Application Menu, as well as tabs.  As with most Microsoft controls, it is limited in features and performance.  If you need a fully featured and high performance ribbon control, be sure to check out the Infragistics XamRibbon.

Accessing collections on non-UI Threads

WPF 4.5 now allows you to access and modify data collections on threads other than the one that created the collection. Using this feature, you can use a background thread to receive data from an external source and display the data on the UI thread. This helps your UI to continue being responsive to user interaction even as you access and manipulate collections.

These are not all. There are several more useful and powerful features that are a part of WPF 4.5. You may refer to the MSDN Library documentation to know more.