WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.7' for table 'wp_options']
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1715718949.9638020992279052734375', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)


Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372
{"id":606,"date":"2011-10-05T15:15:52","date_gmt":"2011-10-05T14:15:52","guid":{"rendered":"http:\/\/www.jonathanantoine.com\/?p=606"},"modified":"2011-10-05T15:17:45","modified_gmt":"2011-10-05T14:17:45","slug":"wpf-4-5-%e2%80%93-part-10-live-shaping","status":"publish","type":"post","link":"http:\/\/www.jonathanantoine.com\/2011\/10\/05\/wpf-4-5-%e2%80%93-part-10-live-shaping\/","title":{"rendered":"WPF 4.5 \u2013 Part 10 : Live shaping (live filtering, grouping and sorting of collections)"},"content":{"rendered":"

\"\"<\/a>For each item list used in a WPF application, a collection view is in fact created and used by the controls. This view enables navigation, filtering, grouping and sorting from the XAML or the code. It is a very powerful feature that is offered to the developers since a long time in WPF.<\/p>\n

In WPF 4.5 as in WPF 4.0 the grouping, sorting and filtering operations are done when the item is added to the collection or when the Refresh method is called. The drawback is that if an item property value involved in one of these operations is updated, then the sorting\/grouping\/filtering will not be done again.<\/p>\n

WPF 4.5 introduce a feature called live shaping which shapes the collection view in live. Let’s dig a little more this feature.<\/strong><\/p>\n

This post is the tenth part of a serie on the WPF 4.5 new features<\/a>.<\/p>\n

<\/p>\n

Basic behavior<\/h3>\n

When you use a collection in WPF, it’s in fact its default view which is used by the controls. You should read Bea Stollnitz’s post on this feature<\/a> if you want more information.<\/p>\n

You can retrieve the default view on the collection by using the CollectionViewSource <\/em>static method named GetDefaultView<\/em>:
\n[csharp] var collectionView
\n = CollectionViewSource.GetDefaultView(Persons) as ICollectionView;[\/csharp]<\/p>\n

The ICollectionView interface exposes methods which enable grouping and sorting<\/strong> described via the GroupDescriptions and SortDescriptions collection respectively. The grouping can then be used in ItemsControl by setting the GroupStyle property. In the snippet below, the persons are sorted and grouped by age:
\n[csharp]\/\/Group by age
\ncollectionView.GroupDescriptions.Add(new PropertyGroupDescription("Age"));<\/p>\n

\/\/sort by age
\ncollectionView.SortDescriptions.Add(new SortDescription("Age",
\n ListSortDirection.Ascending));
\n[\/csharp]<\/p>\n

Also, a predicate can be defined to tells if an item is exposed or not by the view on the collection.<\/strong> In this example we do not expose children(under 18):
\n[csharp]
\nprivate void ApplyFilter(ICollectionView collectionView)
\n{
\n \/\/Apply the filter
\n collectionView.Filter = IsPersonAccepted;
\n}<\/p>\n

\/\/Children are not accepted
\npublic bool IsPersonAccepted(object item)
\n{
\n Person p = item as Person;
\n return (p != null) && p.Age > 18;
\n}
\n[\/csharp]<\/p>\n

The items are filtered, sorted and grouped on two occasions:<\/p>\n