/// <summary> /// Resets the segment drag tooltip information. /// </summary> private void ResetSegmentDragTooltipInfo() { if (highTooltip != null) { SeriesPanel.Children.Remove(highTooltip); highTooltip = null; highDragInfo = null; } if (lowTooltip != null) { SeriesPanel.Children.Remove(lowTooltip); lowTooltip = null; lowDragInfo = null; } }
internal void UpdateSegmentDragValueToolTipHigh(Point pos, ChartSegment segment, double newValue, double offsetY) { if (!EnableDragTooltip) { return; } if (highTooltip == null) { highDragInfo = new ChartDragSegmentInfo() { PostfixLabelTemplate = ActualYAxis.PostfixLabelTemplate, PrefixLabelTemplate = ActualYAxis.PostfixLabelTemplate }; highTooltip = new ContentControl { Content = highDragInfo }; SeriesPanel.Children.Add(highTooltip); if (DragTooltipTemplate == null) { highTooltip.ContentTemplate = IsActualTransposed ? ChartDictionaries.GenericCommonDictionary["SegmentDragInfoOppRight"] as DataTemplate : ChartDictionaries.GenericCommonDictionary["SegmentDragInfo"] as DataTemplate; } else { highTooltip.ContentTemplate = DragTooltipTemplate; } } highDragInfo.Segment = segment; highDragInfo.Brush = segment.Interior; highDragInfo.ScreenCoordinates = pos; ((ChartDragSegmentInfo)highDragInfo).NewValue = newValue; highDragInfo.Segment = segment; highTooltip.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); if (IsActualTransposed) { if (pos.X < 0) { Canvas.SetTop(highTooltip, pos.Y - highTooltip.DesiredSize.Height / 2); Canvas.SetLeft(highTooltip, 0); } else { Canvas.SetTop(highTooltip, pos.Y - highTooltip.DesiredSize.Height / 2); Canvas.SetLeft(highTooltip, pos.X); } } else { double posY = pos.Y - highTooltip.DesiredSize.Height; if (posY < 0) { Canvas.SetTop(highTooltip, 0); Canvas.SetLeft(highTooltip, pos.X - highTooltip.DesiredSize.Width / 2); } else { Canvas.SetTop(highTooltip, posY); Canvas.SetLeft(highTooltip, pos.X - highTooltip.DesiredSize.Width / 2); } } }