void CreateTextEditor()
        {
            if (textEditorHost != null)
            {
                return;
            }

            textEditor                   = AvalonEditTextEditorAdapter.CreateAvalonEditInstance();
            textEditor.IsReadOnly        = true;
            textEditor.MouseDoubleClick += TextEditorDoubleClick;

            textEditorHost       = new ElementHost();
            textEditorHost.Dock  = DockStyle.Fill;
            textEditorHost.Child = textEditor;
        }
示例#2
0
        void CreateTextEditor()
        {
            if (textEditorHost != null)
            {
                return;
            }

            textEditor = AvalonEditTextEditorAdapter.CreateAvalonEditInstance();

            textEditor.IsReadOnly        = true;
            textEditor.MouseDoubleClick += TextEditorDoubleClick;

            var adapter           = new AvalonEditTextEditorAdapter(textEditor);
            var textMarkerService = new TextMarkerService(adapter.TextEditor.Document);

            adapter.TextEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            adapter.TextEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(ITextMarkerService), textMarkerService);

            textEditorHost       = new ElementHost();
            textEditorHost.Dock  = DockStyle.Fill;
            textEditorHost.Child = textEditor;
        }