OneWayToSource Binding seems broken in .NET 4.0
I have this simple piece of Xaml
Is this the desired behavior for a OneWayToSource Binding in .NET 4.0?
Yes. This is done for developer's ability to change provided value without clumsy converters.
What was the problem with the way it worked in 3.5?
No problem. The way it worked in 3.5 didn't allow to correct provided values.
In what scenarios is this new behavior better?
When you need to correct provided values. If you don't need it, then you should just write correct property's getter and setter.
public string TextProperty
{
get;
set;
}
However, as I can see, changing UpdateSourceTrigger to "PropertyChanged" preserves values from being reread (so you could leave old property declaration):
private string m_textProperty;
public string TextProperty
{
get
{
return "Should not be used in OneWayToSource Binding";
}
set
{
m_textProperty = value;
}
}