void showSliderTooltip(Point p)
 {
     if (sliderTooltip == null)
     {
         sliderTooltip        = new Popup();
         sliderTooltipControl = new SliderTooltipControl();
         sliderTooltip.Child  = sliderTooltip;
     }
     sliderTooltip.HorizontalOffset = sliderTooltipHorizontalOffset;
     sliderTooltip.VerticalOffset   = p.Y;
     sliderTooltip.IsOpen           = true;
 }
 void showSliderTooltip(Point p)
 {
     if (sliderTooltip == null)
     {
         sliderTooltip = new Popup();
         sliderTooltipControl = new SliderTooltipControl();
         sliderTooltip.Child = sliderTooltip;
     }
     sliderTooltip.HorizontalOffset = sliderTooltipHorizontalOffset;
     sliderTooltip.VerticalOffset = p.Y;
     sliderTooltip.IsOpen = true;
 }
        public Slider AddSlider(Color rectangleColor)
        {
            Slider slider = new Slider()
            {
                Tag = _sliders.Count,
                Minimum = this.Minimum,
                Maximum = this.Maximum,
                Orientation = this.Orientation,                
                Cursor = Orientation == Orientation.Vertical ? Cursors.SizeNS : Cursors.SizeWE
            };
            Style sliderStyle = Application.Current.Resources["SliderStyle"] as Style;
            if (sliderStyle != null)
                slider.Style = sliderStyle;
            if (Orientation == Orientation.Vertical)
            {
                slider.Height = this.Height;
                slider.Width = 22;
            }
            else
            {
                if (_sliders.Count > 0)
                    slider.Width = _sliders[0].Width;
                //else if (_maxLabel != null)
                //    slider.Width = this.Width - _maxLabel.ActualWidth;
                else
                    slider.Width = this.Width;
                slider.Height = 26;
            }

            if (_sliders.Count == 0)
                slider.Value = (this.Minimum + this.Maximum) / 2;
            else
                slider.Value = (_sliders[_sliders.Count - 1].Value + this.Maximum) / 2;

            slider.MouseEnter += new MouseEventHandler(slider_MouseEnter);
            slider.MouseLeave += new MouseEventHandler(slider_MouseLeave);
            slider.MouseMove += new MouseEventHandler(slider_MouseMove);
            if (sliderTooltip == null)
            {
                sliderTooltip = new Popup();
                sliderTooltipControl = new SliderTooltipControl();
                sliderTooltip.Child = sliderTooltipControl;
                sliderTooltipControl.SetTooltipText(slider.Value.ToString("N2"));
            }

            _sliders.Add(slider);

            if(CanvasRoot != null)
                CanvasRoot.Children.Add(slider);

            addRectangle(rectangleColor);

            slider.ValueChanged += Slider_ValueChanged;
            return slider;
        }
        public Slider AddSlider(Color rectangleColor)
        {
            Slider slider = new Slider()
            {
                Tag         = _sliders.Count,
                Minimum     = this.Minimum,
                Maximum     = this.Maximum,
                Orientation = this.Orientation,
                Cursor      = Orientation == Orientation.Vertical ? Cursors.SizeNS : Cursors.SizeWE
            };
            Style sliderStyle = Application.Current.Resources["SliderStyle"] as Style;

            if (sliderStyle != null)
            {
                slider.Style = sliderStyle;
            }
            if (Orientation == Orientation.Vertical)
            {
                slider.Height = this.Height;
                slider.Width  = 22;
            }
            else
            {
                if (_sliders.Count > 0)
                {
                    slider.Width = _sliders[0].Width;
                }
                //else if (_maxLabel != null)
                //    slider.Width = this.Width - _maxLabel.ActualWidth;
                else
                {
                    slider.Width = this.Width;
                }
                slider.Height = 26;
            }

            if (_sliders.Count == 0)
            {
                slider.Value = (this.Minimum + this.Maximum) / 2;
            }
            else
            {
                slider.Value = (_sliders[_sliders.Count - 1].Value + this.Maximum) / 2;
            }

            slider.MouseEnter += new MouseEventHandler(slider_MouseEnter);
            slider.MouseLeave += new MouseEventHandler(slider_MouseLeave);
            slider.MouseMove  += new MouseEventHandler(slider_MouseMove);
            if (sliderTooltip == null)
            {
                sliderTooltip        = new Popup();
                sliderTooltipControl = new SliderTooltipControl();
                sliderTooltip.Child  = sliderTooltipControl;
                sliderTooltipControl.SetTooltipText(slider.Value.ToString("N2"));
            }

            _sliders.Add(slider);

            if (CanvasRoot != null)
            {
                CanvasRoot.Children.Add(slider);
            }

            addRectangle(rectangleColor);

            slider.ValueChanged += Slider_ValueChanged;
            return(slider);
        }