public static void AddInlineAdornment(ITextView view, UIElement uiElement, RoutedEventHandler onLoaded) { var manager = GetManager(view); if (manager != null) { var adornment = new ZoomableInlineAdornment(uiElement, view); // Original Python code unhooked this event after load was complete // I don't think this should be needed... we'll see. adornment.Loaded += onLoaded; manager.AddAdornment(adornment); } }
public void AddAdornment(ZoomableInlineAdornment uiElement) { if (Dispatcher.CurrentDispatcher != dispatcher) { dispatcher.BeginInvoke(new Action(() => AddAdornment(uiElement))); return; } var caretPos = textView.Caret.Position.BufferPosition; var caretLine = caretPos.GetContainingLine(); tags.Add(new Tuple <int, ZoomableInlineAdornment>(caretPos.Position, uiElement)); var handler = TagsChanged; if (handler != null) { var span = new SnapshotSpan(textView.TextSnapshot, caretLine.Start, caretLine.Length); var args = new SnapshotSpanEventArgs(span); handler(this, args); } }