public RangeSlider()
{
InitializeComponent();
LowText.textBox.Text = "0";
HighText.textBox.Text = "100";
// Set bindings for the sliders to change the values of the
// text boxes
Binding b = new Binding();
b.Source = LowSlider;
b.Path = new PropertyPath("Value", LowSlider.Value);
b.Mode = BindingMode.TwoWay;
b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
LowText.textBox.SetBinding(TextBox.TextProperty, b);
b = new Binding();
b.Source = HighSlider;
b.Path = new PropertyPath("Value", HighSlider.Value);
b.Mode = BindingMode.TwoWay;
b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
HighText.textBox.SetBinding(TextBox.TextProperty, b);
// Check to ensure that the low slider doesn't exceed the high slider
LowSlider.ValueChanged += LowSlider_ValueChanged;
HighSlider.ValueChanged += HighSlider_ValueChanged;
}