WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.144' for table 'wp_options']
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1715849541.1915071010589599609375', '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":441,"date":"2011-09-22T14:00:19","date_gmt":"2011-09-22T13:00:19","guid":{"rendered":"http:\/\/www.jonathanantoine.com\/?p=441"},"modified":"2011-09-22T14:16:55","modified_gmt":"2011-09-22T13:16:55","slug":"wpf-4-5-part-5-the-new-bindingexpression-information","status":"publish","type":"post","link":"http:\/\/www.jonathanantoine.com\/2011\/09\/22\/wpf-4-5-part-5-the-new-bindingexpression-information\/","title":{"rendered":"WPF 4.5 – Part 5 : the new BindingExpression information"},"content":{"rendered":"

\"\"<\/a>BindingExpression is a useful API when working with Bindings from code. In WPF 4.0 it lacks some information which would have made it even mode helpful. Let’s discover what WPF 4.5 brought with him on this class.<\/p>\n

For the record, this post is a part of a serie about WPF 4.5 new features<\/a>.<\/p>\n

<\/p>\n

The MSDN page on WPF 4.5<\/a> new features sum-up very well what API has been added. So I will only explain a little more what it means and try to define in my own way the key terms.<\/p>\n

What is a Binding ?<\/h3>\n

Let’s tell that we have the Text property of a TextBlock binded to the Name Property of ViewModel.
\n[xml] <TextBlock x:Name="_textBlockWithBinding" Text="{Binding Name}" \/>[\/xml]<\/p>\n

Then in this case you will have several elements defined by the Binding<\/strong>:<\/p>\n

    \n
  1. The target<\/strong> is the TextBlock. This is the object on which the Binding is done : where the data goes;<\/li>\n
  2. The target property<\/strong> is the DependencyProperty of the target object on which the binding is defined. Here it is the ‘Text’ Dependency property of the TextBlock;<\/li>\n
  3. The source <\/strong>is the ViewModel : where the data comes from;<\/li>\n
  4. The source property<\/strong> is the property aimed by Binding. Here it is the ‘Name’ property of the ViewModel. This element is retrieved from the Path property of the Binding;<\/li>\n<\/ol>\n

    Then we have to define the notion of ‘BindingGroup’<\/strong> which is a way to create relationships between Bindings.
    \nThe goal is to be able to create ValidationRules for a group of properties instead of validating them one at a time.
    \nYou define a BindingGroup on a Panel and the controls inside of it are, excepting some case, a part of it. The Panel on which the BindingGroup is defined is known as the BindingGroup owner<\/strong>.<\/p>\n

    The BindingGroup class exposes then some method to manage the binded object state : BeginEdit, CommitEdit, CancelEdit. You can think of it as a way to perform the same feature as the IEditableObject. <\/p>\n

    Here is the MSDN example on how to define a BindingGroup from the XAML:
    \n[xml]<StackPanel.BindingGroup>
    \n <BindingGroup NotifyOnValidationError="True">
    \n <BindingGroup.ValidationRules>
    \n <src:ValidateDateAndPrice ValidationStep="ConvertedProposedValue" \/>
    \n <\/BindingGroup.ValidationRules>
    \n <\/BindingGroup>
    \n <\/StackPanel.BindingGroup>
    \n[\/xml]<\/p>\n

    If you want more information on the BindingGroup, you can read this two posts:<\/p>\n

      \n
    1. The BindingGroup page on MSDN<\/a>, especially the ‘Remarks’ section;<\/li>\n
    2. This blog post of Vincent Sibal<\/a>;<\/li>\n<\/ol>\n

      How to retrieve the Binding Expression ?<\/h3>\n

      The Binding expression is an object which contains information about a Binding.
      \n<\/strong>
      \nTo retrieve it, you have to know two things: the target property and the target object. Then you can call a static method from the BindingOperation class named ‘GetBindingExpression’ as in the following snippet:
      \n[csharp] BindingExpression bindingExpresion = BindingOperations
      \n .GetBindingExpression(_textBlockWithBinding, TextBlock.TextProperty);[\/csharp]<\/p>\n

      Since WPF 4.5, the following property have been added to the BindingExpression class:<\/strong><\/p>\n

        \n
      1. Target<\/strong>: the target of the binding which is a DependencyObject;<\/li>\n
      2. TargetProperty<\/strong>: the DependencyProperty targeted by the Binding;<\/li>\n
      3. ResolvedSource<\/strong>: the object used as a source for the Binding; It can be null if it’s not found;<\/li>\n
      4. ResolvedSourcePropertyName<\/strong>: the name of the source property used. It is null if the ResolvedSource is null. This is not the Path but only the property name;<\/li>\n
      5. BindingGroup<\/strong>: the Binding group of the Binding if it exists;<\/li>\n
      6. BindingGroup.Owner<\/strong>: the object that this BindingGroup, if it exists, is assigned to;<\/li>\n<\/ol>\n

        [csharp]\/\/The target
        \nDependencyObject target = bindingExpresion.Target;<\/p>\n

        \/\/The target property
        \nDependencyProperty targetProperty = bindingExpresion.TargetProperty;<\/p>\n

        \/\/The source object
        \nobject source = bindingExpresion.ResolvedSource;<\/p>\n

        \/\/The source property name
        \nstring sourcePropertyName = bindingExpresion.ResolvedSourcePropertyName;<\/p>\n

        \/\/The binding group
        \nBindingGroup bindingGroup = bindingExpresion.BindingGroup;<\/p>\n

        \/\/The binding group’s owner
        \n if (bindingGroup != null)
        \n {
        \n DependencyObject bindingGroupOwner = bindingExpresion.BindingGroup.Owner;
        \n }<\/p>\n

        [\/csharp]<\/p>\n

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

        BindingExpression is a useful API when working with Bindings from code. In WPF 4.0 it lacks some information which would have made it even mode helpful. Let’s discover what WPF 4.5 brought with him on…<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/441"}],"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=441"}],"version-history":[{"count":22,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/441\/revisions"}],"predecessor-version":[{"id":492,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/441\/revisions\/492"}],"wp:attachment":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media?parent=441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/categories?post=441"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/tags?post=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}