public CartesianChart() { InitializeComponent(); if (!(FindByName("canvas") is NaturalVisualCanvas canvas)) { throw new Exception( $"SkiaElement not found. This was probably caused because the control {nameof(CartesianChart)} template was overridden, " + $"If you override the template please add an {nameof(NaturalVisualCanvas)} to the template and name it 'canvas'"); } core = new CartesianChartCore <SkiaDrawingContext>(this, canvas.CanvasCore); core.Update(); SizeChanged += CartesianChart_SizeChanged; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (!(Template.FindName("canvas", this) is NaturalGeometriesCanvas canvas)) { throw new Exception( $"{nameof(SKElement)} not found. This was probably caused because the control {nameof(CartesianChart)} template was overridden, " + $"If you override the template please add an {nameof(NaturalGeometriesCanvas)} to the template and name it 'canvas'"); } this.canvas = canvas; core = new CartesianChartCore <SkiaDrawingContext>(this, canvas.CanvasCore); legend = Template.FindName("legend", this) as IChartLegend <SkiaDrawingContext>; tooltip = Template.FindName("tooltip", this) as IChartTooltip <SkiaDrawingContext>; core.Update(); }
private void OnSizeChanged(object sender, SizeChangedEventArgs e) { core.Update(); }
private void CartesianChart_SizeChanged(object sender, EventArgs e) { core.Update(); }