views:

448

answers:

1

In WPF Binding.Mode, when selecting Default, it depends in the property being binded.

I am looking for some list or some convention or any information for the defaults for the various controls.
I mean, what properties is TwoWay by default and so on. Any links, ideas, thoughts and even rants are welcommed!

+5  A: 

Similar to UpdateSourceTrigger, the default value for the Mode property varies for each property. User-editable properties such as TextBox.Text, ComboBox.Text, MenuItem.IsChecked, etc, have TwoWay as their default Mode value. To figure out if the default is TwoWay, look at the Dependency Property Information section of the property. If it says BindsTwoWayByDefault is set to true, then the default Mode value of the property is TwoWay. To do it programmatically, get the property metadata of the property by calling GetMetadata and then check the boolean value of the BindsTwoWayByDefault property.

Source: http://blogs.msdn.com/wpfsdk/archive/2006/10/19/wpf-basic-data-binding-faq.aspx

The safest way would be to always be explicit what kind of binding mode you want from a binding.

Lars Truijens
Is there a place where I can find a list of all the properties and their BindingMode defaults? what are the rules?
Shimmy
The list of properties is endless. I guess http://msdn.microsoft.com lists most of the ones from Microsoft. I don't see any information and the binding mode there so I guess you would have to find that out by yourself. The url that I gave in my answer explains how to find them
Lars Truijens