public CodeEditor() { CodeEditorOptions.Instance.PropertyChanged += CodeEditorOptions_Instance_PropertyChanged; CustomizedHighlightingColor.ActiveColorsChanged += CustomizedHighlightingColor_ActiveColorsChanged; SD.ParserService.ParseInformationUpdated += ParserServiceParseInformationUpdated; this.FlowDirection = FlowDirection.LeftToRight; // code editing is always left-to-right this.document = new TextDocument(); var documentServiceContainer = document.GetRequiredService<IServiceContainer>(); textMarkerService = new TextMarkerService(document); documentServiceContainer.AddService(typeof(ITextMarkerService), textMarkerService); iconBarManager = new IconBarManager(); documentServiceContainer.AddService(typeof(IBookmarkMargin), iconBarManager); if (CodeEditorOptions.Instance.EnableChangeMarkerMargin) { changeWatcher = new DefaultChangeWatcher(); } primaryTextEditor = CreateTextEditor(); primaryTextEditorAdapter = (CodeEditorAdapter)primaryTextEditor.TextArea.GetService(typeof(ITextEditor)); Debug.Assert(primaryTextEditorAdapter != null); this.ColumnDefinitions.Add(new ColumnDefinition()); this.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); this.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star), MinHeight = minRowHeight }); SetRow(primaryTextEditor, 1); this.Children.Add(primaryTextEditor); }