LiveShaping – repositioning elements when its bound data changes

With WPF 4.0, when an item in a collection was added or removed, the CollectionView interface that it belonged to had its filtering, sorting, and ordering updated. However, this did not happen when we modified one of its item's properties.

Now, with WPF 4.5, we can implement this behavior in real-time with the new ICollectionViewLiveShaping interface, so if the data is updated, so will its filtering, sorting, and ordering. Let's see how it's done.

Getting ready

In order to use this recipe you should have Visual Studio 2012 installed.

How to do it...

Here we are going to see how to implement the ICollectionViewLiveShaping interface to make our collection update its sorting of the collection ...

Get Microsoft .NET Framework 4.5 Quickstart Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.