Пример #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="textEditor"></param>
 public EditorAdapter( TextEditor textEditor )
 {
     this.textEditor =  textEditor;
     editorHelper = new EditorHelper( textEditor );
     bkM = (BreakPointMargin)textEditor.TextArea.LeftMargins[ 0 ];
 }
Пример #2
0
        static void OnShowLineNumbersChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TextEditor editor = (TextEditor)d;
            var leftMargins = editor.TextArea.LeftMargins;
            if ((bool)e.NewValue) {
                LineNumberMargin lineNumbers = new LineNumberMargin();
                Line line = (Line)DottedLineMargin.Create();
                BreakPointMargin PicturePanel = new BreakPointMargin( editor );

                leftMargins.Insert( 0, PicturePanel );
                leftMargins.Insert( 1, lineNumbers );
                leftMargins.Insert( 2, line );

                var lineNumbersForeground = new Binding("LineNumbersForeground") { Source = editor };
                //line1.SetBinding( Line.StrokeProperty, lineNumbersForeground );
                line.SetBinding( Line.StrokeProperty, lineNumbersForeground );
                lineNumbers.SetBinding(Control.ForegroundProperty, lineNumbersForeground);

            } else {
                for (int i = 0; i < leftMargins.Count; i++) {
                    if (leftMargins[i] is LineNumberMargin) {
                        leftMargins.RemoveAt(i);
                        if (i < leftMargins.Count && DottedLineMargin.IsDottedLineMargin(leftMargins[i])) {
                            leftMargins.RemoveAt(i);
                        }
                        break;
                    }
                }
            }
        }