private void CreateIndicatorRect(CanvasControl canvasControl) { if (canvasObject != null) { canvasObject.Remove(); } // visualize it var shapePaintable = new RectangleIndicatorInstaller(targetBounds) { Template = (DataTemplate)canvasControl.TryFindResource("LayerPaintableRectangleTemplateKey") }; canvasObject = shapePaintable.AddCanvasObject(canvasControl.CanvasContext, ((GraphControl)canvasControl).BackgroundGroup, targetBounds); }