WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.194' for table 'wp_options']
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1714969442.4976680278778076171875', '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":181,"date":"2011-09-06T00:19:39","date_gmt":"2011-09-05T23:19:39","guid":{"rendered":"http:\/\/www.jonathanantoine.com\/?p=181"},"modified":"2011-09-06T00:27:32","modified_gmt":"2011-09-05T23:27:32","slug":"wpfs-datagridcheckboxcolumn-elementstyle-uses-a-wrong-default-value","status":"publish","type":"post","link":"http:\/\/www.jonathanantoine.com\/2011\/09\/06\/wpfs-datagridcheckboxcolumn-elementstyle-uses-a-wrong-default-value\/","title":{"rendered":"WPF’s DataGridCheckBoxColumn ElementStyle uses a wrong default value"},"content":{"rendered":"

\"checkbox<\/a>Today I found out a strange behavior in the DataGridCheckBoxColumn: it was not using the default template I set in the resources for the CheckBoxes and uses the default WPF’s one instead. This happens always when you set the AutoGeneratedColumns option to true and a work-around exists otherwise.<\/p>\n

<\/p>\n

My fellow geek Jacob Reimers<\/a> found out that it was a bug in the DataGridCheckBoxColumn’s implementation. Instead of seeking for a Style in the resources, the DataGridCheckBoxColumn creates a new one from scratch and assign it to the CheckBox if you don’t set the ElementStyle property. When the columns are auto-generated, the ElementStyle can’t be set and you have no choice than to have this default style. When you don’t auto-generate the columns, you can set your own custom style and override the default one (happy us !).<\/p>\n

A work-around exists(ourah !)<\/h4>\n

Jacob told me: “why don’t you register to the DataGrid’s AutoGeneratingColumn event and set the ElementStyle there ?<\/em><\/strong>“. That’s actually a great idea and it works like a charm. Here is the snippet which performs it:<\/p>\n

[csharp]
\nvoid grid_AutoGeneratingColumn(object sender,
\n DataGridAutoGeneratingColumnEventArgs e)
\n{
\n if(e.Column is DataGridCheckBoxColumn)
\n {
\n var checkBoxColumn = e.Column as DataGridCheckBoxColumn;
\n var resource = Application.Current.FindResource(typeof(CheckBox));
\n checkBoxColumn.ElementStyle = resource as Style;
\n }
\n}
\n[\/csharp]<\/p>\n

As I was porting the Jetpack Theme to WPF<\/a>\u00a0I thought it was a little embarrasing to force the users to handle an event just to fix this – little – bug. <\/p>\n

So I came up with this enhanced solution in two parts:<\/p>\n

    \n
  1. an attached property which do exactly the same job than before,<\/li>\n
  2. a default style for the DataGrid which set it by default on the DataGrid.<\/li>\n<\/ol>\n

    <\/strong><\/p>\n

    As you are now experts with attached properties<\/a>, I let you discover the code directly on Codeplex<\/a>. <\/p>\n

    On the other hand, here is the default Style setter I use for the DataGrid:
    \n[xml]<Style TargetType="{x:Type DataGrid}">
    \n <Setter Property="helpers:DataGridCheckBoxColumnFixer.Fix" Value="True" \/>
    \n<\/Style>[\/xml]<\/p>\n

    \"\"<\/a><\/p>\n

    If you can reproduce this bug, share it on Connect too<\/a> ! The WPF team have done a great job with this control and this is just a little tiny bug and I hope this will be corrected in the vNext…<\/p>\n

    Regards.<\/p>\n","protected":false},"excerpt":{"rendered":"

    Today I found out a strange behavior in the DataGridCheckBoxColumn: it was not using the default template I set in the resources for the CheckBoxes and uses the default WPF’s one instead. This happens always…<\/p>\n","protected":false},"author":3,"featured_media":196,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,5],"tags":[23,14,15,20],"_links":{"self":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/181"}],"collection":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/comments?post=181"}],"version-history":[{"count":21,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":204,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/181\/revisions\/204"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media\/196"}],"wp:attachment":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media?parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/categories?post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/tags?post=181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}