private void mcChart_Loaded(object sender, RoutedEventArgs e) { EdgePanel ep = VisualHelper.FindChild <EdgePanel>(sender as Chart, "ChartArea"); if (ep != null) { var grid = ep.Children.OfType <Grid>().FirstOrDefault(); if (grid != null) { grid.Background = new SolidColorBrush(Colors.Transparent); } var border = ep.Children.OfType <Border>().FirstOrDefault(); if (border != null) { border.BorderBrush = new SolidColorBrush(Colors.Transparent); } } Legend legend = VisualHelper.FindChild <Legend>(sender as Chart, "Legend"); if (legend != null) { legend.Background = new SolidColorBrush(Colors.Transparent); legend.BorderBrush = new SolidColorBrush(Colors.Transparent); } }
private bool IsPlotArea(DependencyObject dependencyObject, out EdgePanel edgePanel) { edgePanel = null; while (dependencyObject != null) { if (dependencyObject.GetType() == typeof(EdgePanel)) { edgePanel = (EdgePanel)dependencyObject; return(true); } dependencyObject = VisualTreeHelper.GetParent(dependencyObject); } return(false); }
/// <summary> /// Sets the Edge property of an axis based on its location and /// orientation. /// </summary> /// <param name="axis">The axis to set the edge property of.</param> private static void SetEdge(Axis axis) { switch (axis.Location) { case AxisLocation.Bottom: EdgePanel.SetEdge(axis, Edge.Bottom); break; case AxisLocation.Top: EdgePanel.SetEdge(axis, Edge.Top); break; case AxisLocation.Left: EdgePanel.SetEdge(axis, Edge.Left); break; case AxisLocation.Right: EdgePanel.SetEdge(axis, Edge.Right); break; } }