For that reason, I have added a button next to the Text Box, which will update the source value on demand.
In the Code-behind, you will find the Click handler, where we use a couple of lines of code to get the binding from the destination control and then call the Update Source() method on it.
In addition to using data binding to control the tabs that appear in a Tab Control, you can use binding to control which tab is currently selected.
Below, we bind the Selected Index of a Tab Control to a property in our class.
When you run the app, it looks like this: If you select Steve Smith from the left List Box, the UI updates accordingly: However, if you then select Dave Brown again from the right List Box (the one bound to grouped data), watch what happens: Yikes!! According to rules of WPF, a local value takes precedence over the value provided by a binding.
So, the binding established on the List Box Item’s Is Selected property is overwritten by a local value.
The first two has already been described, while the last one simply means that the update has to be pushed manually through to occur, using a call to Update Source on the Binding.
Full Code As shown in the code, shown above, we define combo box followed by the item template and the data template.
That doesn’t happen very often, but today was one of those days.
The third and last Text Box uses the Property Changed value, which means that the source value will be updated each time the bound property changes, which it does in this case as soon as the text changes.
Try running the example on your own machine and see how the three textboxes act completely different: The first value doesn't update before you click the button, the second value isn't updated until you leave the Text Box, while the third value updates automatically on each keystroke, text change etc.
This blog post shows the workaround I came up with.