Coerce a WPF TextBox not working anymore in .NET 4.0
In my WPF application I have a TextBox where the user can enter a percentage (as int, between 1 and 100). The Text property is databound to a property in a ViewModel, where I coerce the value to be in the given range in the setter. However, in .NET 3.5, the data is not shown properly in the UI after being coerced. In this post on MSDN , Dr. WPF states that you have to manually update the binding so the correct will be shown. Therefore, I have a TextChanged handler (in the View) which calls UpdateTarget() . In code: View XAML: <TextBox Text="{Binding Percentage, Mode=TwoWay, UpdateSourceTrigger