@@ -31,6 +31,7 @@ public GraphControl()
3131 layersControl = new StackPanel { Orientation = Orientation . Vertical } ;
3232
3333 canvas = new Canvas ( ) ;
34+ canvas . SetResourceReference ( Panel . BackgroundProperty , "Theme_WhiteBackground" ) ;
3435
3536 grid = new Grid ( ) ;
3637 grid . Children . Add ( canvas ) ;
@@ -207,6 +208,12 @@ void AddLine(FrameworkElement fromControl, FrameworkElement toControl, Brush str
207208 AddLine ( sourcePoint , destinationPoint , stroke ) ;
208209 }
209210
211+ void AddRectangle ( FrameworkElement element , Brush stroke , Brush fill = null )
212+ {
213+ var rect = GetRectOnCanvas ( element ) ;
214+ AddRectangle ( rect , stroke , fill ) ;
215+ }
216+
210217 void AddRectangle ( Rect rect , Brush stroke , Brush fill = null )
211218 {
212219 var rectangleShape = new System . Windows . Shapes . Rectangle
@@ -260,8 +267,6 @@ private void SelectControls(FrameworkElement fromControl, FrameworkElement toCon
260267 }
261268
262269 var highlighted = new HashSet < FrameworkElement > ( ) ;
263- highlighted . Add ( fromControl ) ;
264- highlighted . Add ( toControl ) ;
265270
266271 var edges = new HashSet < ( FrameworkElement start , FrameworkElement end ) > ( ) ;
267272
@@ -282,12 +287,17 @@ private void SelectControls(FrameworkElement fromControl, FrameworkElement toCon
282287 }
283288 } ) ;
284289
290+ highlighted . Remove ( fromControl ) ;
291+ highlighted . Remove ( toControl ) ;
292+
285293 foreach ( var highlight in highlighted )
286294 {
287- var rect = GetRectOnCanvas ( highlight ) ;
288- AddRectangle ( rect , new SolidColorBrush ( Colors . Red ) , Brushes . Pink ) ;
295+ AddRectangle ( highlight , new SolidColorBrush ( Colors . Blue ) , Brushes . Azure ) ;
289296 }
290297
298+ AddRectangle ( fromControl , Brushes . Red , Brushes . Pink ) ;
299+ AddRectangle ( toControl , Brushes . Red , Brushes . Pink ) ;
300+
291301 foreach ( var edge in edges )
292302 {
293303 AddLine ( edge . start , edge . end , outgoingBrush ) ;
0 commit comments