GetThumbHeight() 정적인 개인적인 메소드

static private GetThumbHeight ( System.Windows.Controls.Slider slider ) : double
slider System.Windows.Controls.Slider
리턴 double
예제 #1
0
        private void AdjustWidths(double minimum, double maximum, double lowerValue, double higherValue)
        {
            double actualWidth            = 0;
            double lowerSliderThumbWidth  = 0d;
            double higherSliderThumbWidth = 0d;

            if (this.Orientation == OrientationEnum.Horizontal)
            {
                actualWidth            = this.ActualWidth;
                lowerSliderThumbWidth  = RangeSlider.GetThumbWidth(_lowerSlider);
                higherSliderThumbWidth = RangeSlider.GetThumbWidth(_higherSlider);
            }
            else if (this.Orientation == OrientationEnum.Vertical)
            {
                actualWidth            = this.ActualHeight;
                lowerSliderThumbWidth  = RangeSlider.GetThumbHeight(_lowerSlider);
                higherSliderThumbWidth = RangeSlider.GetThumbHeight(_higherSlider);
            }

            actualWidth -= (lowerSliderThumbWidth + higherSliderThumbWidth);

            double entireRange = maximum - minimum;

            this.HigherRangeWidth = (actualWidth * (maximum - higherValue)) / entireRange;

            this.RangeWidth = (actualWidth * (higherValue - lowerValue)) / entireRange;

            this.LowerRangeWidth = (actualWidth * (lowerValue - minimum)) / entireRange;
        }
        private void AdjustView(bool isHigherValueChanged = false)
        {
            //Coerce values to make them consistent.
            var 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);

            if (!this.IsDeferredUpdateValues || (_deferredUpdateValue == null))
            {
                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)
            {
                var higherValue = this.IsDeferredUpdateValues && isHigherValueChanged && (_deferredUpdateValue != null) ? _deferredUpdateValue.Value : cv.HigherValue;
                var lowerValue  = this.IsDeferredUpdateValues && !isHigherValueChanged && (_deferredUpdateValue != null) ? _deferredUpdateValue.Value : cv.LowerValue;

                this.HigherRangeWidth = (actualWidth * (cv.Maximum - higherValue)) / entireRange;

                this.RangeWidth = (actualWidth * (higherValue - lowerValue)) / entireRange;

                this.LowerRangeWidth = (actualWidth * (lowerValue - cv.Minimum)) / entireRange;
            }
            else
            {
                this.HigherRangeWidth = 0d;
                this.RangeWidth       = 0d;
                this.LowerRangeWidth  = actualWidth;
            }
        }
        private void AdjustView()
        {
            //Coerce values to make them consistent.
            var 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;
            }
        }
        private void SetSlidersMargins()
        {
            if ((_lowerSlider != null) && (_higherSlider != null))
            {
                if (this.Orientation == Orientation.Horizontal)
                {
                    double lowerSliderThumbWidth  = RangeSlider.GetThumbWidth(_lowerSlider);
                    double higherSliderThumbWidth = RangeSlider.GetThumbWidth(_higherSlider);

                    _higherSlider.Margin = new Thickness(lowerSliderThumbWidth, 0d, 0d, 0d);
                    _lowerSlider.Margin  = new Thickness(0d, 0d, higherSliderThumbWidth, 0d);
                }
                else
                {
                    double lowerSliderThumbHeight  = RangeSlider.GetThumbHeight(_lowerSlider);
                    double higherSliderThumbHeight = RangeSlider.GetThumbHeight(_higherSlider);

                    _higherSlider.Margin = new Thickness(0d, 0d, 0d, lowerSliderThumbHeight);
                    _lowerSlider.Margin  = new Thickness(0d, higherSliderThumbHeight, 0d, 0d);
                }
            }
        }