diff --git a/GraphLayout/tools/WpfGraphControl/AutomaticGraphLayoutControl.xaml.cs b/GraphLayout/tools/WpfGraphControl/AutomaticGraphLayoutControl.xaml.cs index 0445d7a1..c26cefe7 100644 --- a/GraphLayout/tools/WpfGraphControl/AutomaticGraphLayoutControl.xaml.cs +++ b/GraphLayout/tools/WpfGraphControl/AutomaticGraphLayoutControl.xaml.cs @@ -15,12 +15,8 @@ public Graph Graph { public static readonly DependencyProperty GraphProperty = DependencyProperty.Register("Graph", typeof(Graph), typeof(AutomaticGraphLayoutControl), new PropertyMetadata(default(Graph), (d,e)=> ((AutomaticGraphLayoutControl)d)?.SetGraph())); - + private void SetGraph() { - if (Graph == null) { - dockPanel.Children.Clear(); - return; - } if (_graphViewer == null) { _graphViewer = new GraphViewer(); _graphViewer.BindToPanel(dockPanel); diff --git a/GraphLayout/tools/WpfGraphControl/GraphViewer.cs b/GraphLayout/tools/WpfGraphControl/GraphViewer.cs index 31b8aaf0..ad72471d 100644 --- a/GraphLayout/tools/WpfGraphControl/GraphViewer.cs +++ b/GraphLayout/tools/WpfGraphControl/GraphViewer.cs @@ -746,7 +746,10 @@ void ProcessGraphUnderLock() { CancelToken = new CancelToken(); - if (_drawingGraph == null) return; + if (_drawingGraph == null) { + ClearGraphViewer(); + return; + } HideCanvas(); ClearGraphViewer();