private void AdjustView()
{
//Coerce values to make them consistent.
CoercedValues cv = this.GetCoercedValues();
double actualWidth = 0;
double lowerSliderThumbWidth = 0d;
double higherSliderThumbWidth = 0d;
if( this.Orientation == Orientation.Horizontal )
{
actualWidth = this.ActualWidth;
lowerSliderThumbWidth = RangeSlider.GetThumbWidth( _lowerSlider );
higherSliderThumbWidth = RangeSlider.GetThumbWidth( _higherSlider );
}
else if( this.Orientation == Orientation.Vertical )
{
actualWidth = this.ActualHeight;
lowerSliderThumbWidth = RangeSlider.GetThumbHeight( _lowerSlider );
higherSliderThumbWidth = RangeSlider.GetThumbHeight( _higherSlider );
}
actualWidth -= ( lowerSliderThumbWidth + higherSliderThumbWidth );
this.SetLowerSliderValues( cv.LowerValue, cv.Minimum, cv.Maximum );
this.SetHigherSliderValues( cv.HigherValue, cv.Minimum, cv.Maximum );
double entireRange = cv.Maximum - cv.Minimum;
if( entireRange > 0 )
{
this.HigherRangeWidth = ( actualWidth * ( cv.Maximum - cv.HigherValue ) ) / entireRange;
this.RangeWidth = ( actualWidth * ( cv.HigherValue - cv.LowerValue ) ) / entireRange;
this.LowerRangeWidth = ( actualWidth * ( cv.LowerValue - cv.Minimum ) ) / entireRange;
}
else
{
this.HigherRangeWidth = 0d;
this.RangeWidth = 0d;
this.LowerRangeWidth = actualWidth;
}
}