How do I bind to the XamSliderNumericThumb in a XamNumericRangeSlider?
I found the .Thumbs property, and when I index it in C# to find the Value parameter in intellisense, there is not a Value parameter to bind to. What property do I use to bind to please?
Thanks.
EDIT: I'm using the value of the thumb to bind to another control to change its behavior.
Hello Mike,
To get the value of the thumb you can access by array. E.g.:
<TextBox x:Name="TextBox1" Text="{Binding ElementName=xamNumericRangeSlider1, Path=Thumbs[0].Value, Mode=TwoWay}" Width="100" Height="25" />
I have attached an updated sample.
Duane,
Thanks, but I meant the other way. How do I get the value of the thumb in the text box.
Thanks,
Mike
When binding using the TextBox can be done by setting the ElementName and the Path. E.g.:
<ig:XamSliderNumericThumb Value="{Binding ElementName=TextBox1, Path=Text, Mode=TwoWay}" />
I had to finally use a similar "ViewModel" type approach your sample code employed where I had a variable in a class that both controls pointed to. However, shouldn't one be able to bind the value of the thumb to the textbox text property? I could never figure out how to do that. How do you do it?
In the XamSliderNumericThumb you can bind using the DataContext and setting mode to TwoWay in XAML.
I have attached a sample.