private void OnDockPositionChanged(ChartDock oldValue, ChartDock newValue) { if (LegendPosition == LegendPosition.Outside) { InternalDockPosition = DockPosition; if (ChartArea != null) { ChartArea.LayoutLegends(); ChartArea.UpdateLegendArrangeRect(); } } ChangeOrientation(); if (LegendPosition == LegendPosition.Inside) { var dockPanel = Parent as ChartDockPanel; if (dockPanel == null) { return; } Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); ChartArea.UpdateLegendArrangeRect(); dockPanel.InvalidateMeasure(); } else if (ChartDockPanel.GetDock(this) != InternalDockPosition) { ChartDockPanel.SetDock(this, InternalDockPosition); } }
/// <summary> ///Sets an element's dock position in the Chart area. /// </summary> /// <param name="element"></param> /// <param name="dock"></param> public static void SetDock(UIElement element, ChartDock dock) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(DockProperty, dock); }
private void OnLegendPositionChanged() { if (LegendPosition == Charts.LegendPosition.Inside) { InternalDockPosition = ChartDock.Floating; } else { InternalDockPosition = DockPosition; } ChartDockPanel.SetDock(this, InternalDockPosition); if (Parent != null) { ChartArea.LayoutLegends(); ChartArea.UpdateLegendArrangeRect(); (Parent as ChartDockPanel).InvalidateMeasure(); } }
/// <summary> /// Arranges the elements inside the passing element. /// </summary> /// <param name="element">The Element</param> /// <param name="dock">The Dock Position</param> /// <param name="rect">The Reference Size <see cref="Rect"/></param> private void ArrangeElement(UIElement element, ChartDock dock, Rect rect) { element.Arrange(ChartLayoutUtils.Subtractthickness(rect, ElementMargin)); }