Skip to content

Commit

Permalink
allow assign graphControl.Graph = null and reassign graph
Browse files Browse the repository at this point in the history
  • Loading branch information
trivalik committed Dec 2, 2024
1 parent 94e52ec commit f8270e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion GraphLayout/tools/WpfGraphControl/GraphViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,10 @@ void ProcessGraphUnderLock() {

CancelToken = new CancelToken();

if (_drawingGraph == null) return;
if (_drawingGraph == null) {
ClearGraphViewer();
return;
}

HideCanvas();
ClearGraphViewer();
Expand Down

0 comments on commit f8270e6

Please sign in to comment.