Click here to Skip to main content
13,405,146 members (55,925 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 29 Mar 2011

Don’t Move or I Will Shoot Your Bindings

, 29 Mar 2011
Rate this:
Please Sign up or sign in to vote.
How WPF binding systems sometimes fail silently.

WPF bindings and MVVM are nice when they work, but can become a royal pain when they don’t. This is especially annoying when you create bindings in code, because then you don’t get the automatic tracing which is enabled for bindings in XAML. Any error is silently swallowed. Here’s what I found out (waiting to confirm it with MSDN documentation and independent small tests):

  • if you have a one-way binding and someone changes the target value not using the binding, the binding will be deactivated.
  • if you have a two-way binding, someone changes the target value not using the binding, and something goes wrong updating the source (e.g., converter’s ConvertBack() method throws an exception), your binding will be deactivated.

Deactivated bindings look like they are there, but they don’t do anything. Effectively, binding stops working, and it is often very difficult to know exactly why. If you created the binding in code, you can look at the status of the binding expression. If you created the binding in XAML, getting to its status is much more difficult. Also, it is not possible (to the best of my knowledge) to put a breakpoint when binding status changes: there is no data breakpoints in managed code, and I could not get .NET source debugging to work for WPF bindings for whatever reason. I could see things like DependencyObject, but not BindingOperations.

Bottom line: binding systems sometimes fail silently. Detecting and debugging those failures can be very time consuming and difficult.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ivan Krivyakov
Technical Lead Thomson Reuters
United States United States
Ivan is a hands-on software architect/technical lead working for Thomson Reuters in the New York City area. At present I am mostly building complex multi-threaded WPF application for the financial sector, but I am also interested in cloud computing, web development, mobile development, etc.

Please visit my web site:

You may also be interested in...

Comments and Discussions

GeneralAny other possibilities for Binding deactivation in WPF, apart mentioned 2 possibilities? Pin
Harish Arumalla13-Mar-15 3:45
memberHarish Arumalla13-Mar-15 3:45 
GeneralReason for my vote of 5 Interesting findings regarding bindi... Pin
DrABELL29-Mar-11 9:52
memberDrABELL29-Mar-11 9:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180221.1 | Last Updated 29 Mar 2011
Article Copyright 2011 by Ivan Krivyakov
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid