I'm developing a C#/WPF MVVM application and I have the following controls in my Xaml:
<TextBox Text="{Binding ElementName=PriceSlider, Path=Value, Mode=TwoWay}"/>
<Slider x:Name="PriceSlider" Minimum="0" Maximum="10000"/>
The user should be able to set the textbox's value both by typing it in and through the slider indirectly, so I need this binding between them. Moreover, I should bind the textbox's value into one of my VM's property for validation and further computation.
I thought about using the textbox's TextChanged event with the CallMethodAction of the Xaml.Behaviours package passing the EventArgs, but I guess it wouldn't be so efficient to fire events every time the slider sends a new value.
Is there a way to bind the textbox both to the slider and e.g. OneWayToSource to one of the DataContext's property? Or any other way that is sort of efficient?