/// <summary> /// Constructor for the MatchMarginElement. /// </summary> /// <param name="textView">ITextView to which this MatchMargenElement will be attached.</param> /// <param name="factory">Instance of the MatchMarginFactory that is creating the margin.</param> /// <param name="verticalScrollbar">Vertical scrollbar of the ITextViewHost that contains <paramref name="textView"/>.</param> public MatchMarginElement(IWpfTextView textView, MatchMarginFactory factory, IVerticalScrollBar verticalScrollbar) { _textView = textView; this.IsHitTestVisible = false; _layer = textView.GetAdornmentLayer("MatchMarginAdornmentLayer"); _scrollBar = verticalScrollbar; _editorFormatMap = factory.EditorFormatMapService.GetEditorFormatMap(textView); this.Width = 6.0; _textView.Options.OptionChanged += this.OnOptionChanged; this.IsVisibleChanged += this.OnViewOrMarginVisiblityChanged; _textView.VisualElement.IsVisibleChanged += this.OnViewOrMarginVisiblityChanged; this.OnOptionChanged(null, null); }
/// <summary> /// Constructor for the MatchMargin. /// </summary> /// <param name="textViewHost">The IWpfTextViewHost in which this margin will be displayed.</param> /// <param name="navigator">Instance of an ITextStructureNavigator used to define words in the host's TextView. Created from the /// ITextStructureNavigatorFactory service.</param> public MatchMargin(IWpfTextViewHost textViewHost, IVerticalScrollBar scrollBar, MatchMarginFactory factory) { // Validate if (textViewHost == null) { throw new ArgumentNullException("textViewHost"); } _matchMarginElement = new MatchMarginElement(textViewHost.TextView, factory, scrollBar); }