Ejemplo n.º 1
0
        private void DisplayBalloon(Indicator indicator)
        {
            _balloon.Text       = indicator.Text;
            _balloon.Visibility = Visibility.Visible;
            _balloon.Measure(new Size(_graphCanvasDecorator.ActualWidth, _graphCanvasDecorator.ActualHeight));
            var balloonLeft = (double)indicator.GetValue(Canvas.LeftProperty) - _balloon.DesiredSize.Width / 2 +
                              indicator.ActualWidth / 2;

            if (balloonLeft < 0)
            {
                balloonLeft = (double)indicator.GetValue(Canvas.LeftProperty);
            }
            else if (balloonLeft + _balloon.DesiredSize.Width > _graphCanvasDecorator.ActualWidth)
            {
                balloonLeft = (double)indicator.GetValue(Canvas.LeftProperty) - _balloon.DesiredSize.Width;
            }
            var balloonTop = (double)indicator.GetValue(Canvas.TopProperty) - _balloon.DesiredSize.Height - 5;

            if (balloonTop < 0)
            {
                balloonTop = (double)indicator.GetValue(Canvas.TopProperty) + 17;
            }
            _balloon.SetValue(Canvas.LeftProperty, balloonLeft);
            _balloon.SetValue(Canvas.TopProperty, balloonTop);
        }
Ejemplo n.º 2
0
 private void DisplayBalloon(Indicator indicator)
 {
     _balloon.Text = indicator.Text;
     _balloon.Visibility = Visibility.Visible;
     _balloon.Measure(new Size(_graphCanvasDecorator.ActualWidth, _graphCanvasDecorator.ActualHeight));
     var balloonLeft = (double)indicator.GetValue(Canvas.LeftProperty) - _balloon.DesiredSize.Width / 2 +
                          indicator.ActualWidth / 2;
     if (balloonLeft < 0)
     {
         balloonLeft = (double)indicator.GetValue(Canvas.LeftProperty);
     }
     else if (balloonLeft + _balloon.DesiredSize.Width > _graphCanvasDecorator.ActualWidth)
     {
         balloonLeft = (double)indicator.GetValue(Canvas.LeftProperty) - _balloon.DesiredSize.Width;
     }
     var balloonTop = (double)indicator.GetValue(Canvas.TopProperty) - _balloon.DesiredSize.Height - 5;
     if (balloonTop < 0)
     {
         balloonTop = (double)indicator.GetValue(Canvas.TopProperty) + 17;
     }
     _balloon.SetValue(Canvas.LeftProperty, balloonLeft);
     _balloon.SetValue(Canvas.TopProperty, balloonTop);
 }