private void Window_Loaded(object sender, RoutedEventArgs e) { if (drawGraph == null) { drawGraph = new DrawPersonGraph(graph, canvas1, (int)ActualWidth / 2, (int)ActualHeight - 200, 30, 70); } drawGraph.DrawToCanvas(); }