private void RemoveAdorner() { if (_connectionAdorner != null) { var canvas = OwnerCanvas; if (canvas != null) { var adornerLayer = AdornerLayer.GetAdornerLayer(canvas); if (adornerLayer != null) { adornerLayer.Remove(_connectionAdorner); _connectionAdorner = null; } } } }
private void ShowAdorner() { // the ConnectionAdorner is created once for each Connection if (_connectionAdorner == null) { var designer = VisualTreeHelper.GetParent(this) as DesignerCanvas; var adornerLayer = AdornerLayer.GetAdornerLayer(designer); if (adornerLayer != null) { _connectionAdorner = new ConnectionAdorner(designer, this); adornerLayer.Add(_connectionAdorner); } } _connectionAdorner.Visibility = Visibility.Visible; }