@@ -43,6 +43,7 @@ public GraphControl()
43
43
}
44
44
#endregion
45
45
46
+ public event EventHandler < ElementEventArgs > FocusChanged ;
46
47
public event EventHandler < AcceptNodeEventArgs > NodeAdded ;
47
48
public event EventHandler < AcceptNodeEventArgs > NodeRemoved ;
48
49
public event EventHandler < AcceptNodeConnectionEventArgs > ConnectionAdded ;
@@ -99,6 +100,11 @@ public IElement FocusElement
99
100
internalFocusElement = value ;
100
101
if ( internalFocusElement != null )
101
102
SetFlag ( internalFocusElement , RenderState . Focus , true , false ) ;
103
+
104
+ if ( FocusChanged != null )
105
+ FocusChanged ( this , new ElementEventArgs ( value ) ) ;
106
+
107
+ this . Invalidate ( ) ;
102
108
}
103
109
}
104
110
#endregion
@@ -459,6 +465,7 @@ public bool AddNodes(IEnumerable<Node> nodes)
459
465
{
460
466
BringElementToFront ( lastNode ) ;
461
467
FocusElement = lastNode ;
468
+ this . Invalidate ( ) ;
462
469
}
463
470
return modified ;
464
471
}
@@ -512,6 +519,8 @@ public bool RemoveNodes(IEnumerable<Node> nodes)
512
519
graphNodes . Remove ( node ) ;
513
520
modified = true ;
514
521
}
522
+ if ( modified )
523
+ this . Invalidate ( ) ;
515
524
return modified ;
516
525
}
517
526
#endregion
@@ -593,6 +602,8 @@ public bool Disconnect(NodeConnection connection)
593
602
// Just in case somebody stored it somewhere ..
594
603
connection . From = null ;
595
604
connection . To = null ;
605
+
606
+ this . Invalidate ( ) ;
596
607
return true ;
597
608
}
598
609
#endregion
@@ -1361,18 +1372,15 @@ protected override void OnMouseUp(MouseEventArgs e)
1361
1372
switch ( command )
1362
1373
{
1363
1374
case CommandMode . MarqueSelection :
1364
- needRedraw = true ;
1365
-
1366
1375
if ( abortDrag )
1367
1376
{
1368
1377
foreach ( var node in selectedNodes )
1369
1378
SetFlag ( node , RenderState . Focus , false , false ) ;
1370
1379
1371
1380
foreach ( var node in unselectedNodes )
1372
1381
SetFlag ( node , RenderState . Focus , true , false ) ;
1373
- }
1374
-
1375
- if ( ! abortDrag )
1382
+
1383
+ } else
1376
1384
{
1377
1385
NodeSelection selection = null ;
1378
1386
if ( graphNodes . Count > 0 )
@@ -1386,6 +1394,7 @@ protected override void OnMouseUp(MouseEventArgs e)
1386
1394
}
1387
1395
FocusElement = selection ;
1388
1396
}
1397
+ this . Invalidate ( ) ;
1389
1398
return ;
1390
1399
case CommandMode . ScaleView :
1391
1400
return ;
0 commit comments