Esempio n. 1
0
		static ITextEditorOptions GetTextEditorOptions()
		{
			ICSharpCode.AvalonEdit.TextEditor editor = new ICSharpCode.AvalonEdit.TextEditor();
			AvalonEditTextEditorAdapter adapter = new AvalonEditTextEditorAdapter(editor);
			return adapter.Options;
		}
		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;
		}