public LineNumberMarginAdorner(LineNumberMarginWithCommands marginElement) : base(marginElement) { this.listView = new LineNumbersListView(); this.AddVisualChild(this.listView); // this has to be there for events and interaction to work this.listView.SizeChanged += (_sender, _args) => { trackListViewWidth(); }; // update the adorner layer AdornerLayer.GetAdornerLayer(marginElement).Update(); // setup events that we will need to use to modify our list of line numbers marginElement.LineNumbersChangedDelayedEvent += MarginElement_LineNumbersChangedDelayedEvent; // need to initially populate line numbers that are already there populateLineNumbers(marginElement.uiLineInfoList, this.listView.LineNumbers); }
public static void Install(TextEditor _editor) { var me = new LineNumberMarginWithCommands(_editor); me.Loaded += (_sender, args) => { var adorner1 = new LineNumberMarginAdorner(me); // it's got to be displayed before adorning I think // adorn it adorner1.LineNumberListViewWidthChanged += (_sender2, _args2) => { me.UpdateLineNumberListWidthFromAdorner(_args2.Width); }; AdornerLayer.GetAdornerLayer(me).Add(adorner1); }; _editor.ShowLineNumbers = false; // turn off the built in addLineNumberMarching(_editor, me); }