public override void Hide(AnnotationAdorner adorner) { if (!this.enabled) { return; } AnnotationAdorner.SetAnchor(adorner, AdornerLocation.None); AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(adorner.AdornedElement); if (adornerLayer != null) { adornerLayer.Remove(adorner); } return; }
public override void Show(AnnotationAdorner adorner) { if (!this.enabled) { return; } AnnotationAdorner.SetAnchor(adorner, AdornerLocation.None); adorner.ScrollViewer = this.scrollViewer; AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(adorner.AdornedElement); if (adornerLayer != null) { adornerLayer.Add(adorner); } return; }
protected override Size ArrangeOverride(Size finalSize) { Point anchorPoint = this.AdornedElement.TranslatePoint(new Point(this.AdornedElement.RenderSize.Width, 0), this.ScrollViewer); AdornerLocation anchor = AnnotationAdorner.GetAnchor(this); if (anchor == AdornerLocation.None) { // Calculate based on the real size of the adorner, depending on current zoom level DesignerView designerView = ((WorkflowViewElement)AdornedElement).Context.Services.GetService <DesignerView>(); double zoomLevel = designerView.ZoomFactor; Size adornerSize = new Size(this.content.DesiredSize.Width * zoomLevel, this.content.DesiredSize.Height * zoomLevel); anchor = FindAnchor(anchorPoint, adornerSize, new Rect(0, 0, this.ScrollViewer.ViewportWidth, this.ScrollViewer.ViewportHeight)); AnnotationAdorner.SetAnchor(this, anchor); } Point location = CalculateLocation(anchor, this.AdornedElement.RenderSize, this.content.DesiredSize); this.content.Arrange(new Rect(location, finalSize)); return(finalSize); }