Here's a little XAML fragment. You will see
<StackPanel>
<TextBox x:Name="txtValue">250</TextBox>
<Slider x:Name="slide"
Value="{Binding ElementName=txtValue, Path=Text,
Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
Minimum="0" Maximum="500"></Slider>
</StackPanel>
If I remove the Mode=OneWay
set directive, (defaults to two-way) everything works perfectly.
Why is this happening?
Use mode=TwoWay
and set the UpdateSourceTrigger=Explicit
.
Your data binding is not broken but deactivated (http://en.wikipedia.org/wiki/Euphemism):
System.Windows.Data Warning: 75 : BindingExpression (hash=52697953): Deactivate
System.Windows.Data Warning: 99 : BindingExpression (hash=52697953): Replace item at level 0 with {NullDataItem}
System.Windows.Data Warning: 59 : BindingExpression (hash=52697953): Detach
Setting the trace level to high will produce this message in the VS output window in case you move the slider:
<Slider xmlns:trace="clr-namespace:System.Diagnostics;assembly=WindowsBase"
Value="{Binding trace:PresentationTraceSources.TraceLevel=High,
ElementName=txtValue, Path=Text, Mode=OneWay,
UpdateSourceTrigger=PropertyChanged}"
Minimum="0" Maximum="500"></Slider>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With