diff --git a/src/AvaloniaEdit.Demo/MainWindow.xaml b/src/AvaloniaEdit.Demo/MainWindow.xaml
index bdf9e311..81950c76 100644
--- a/src/AvaloniaEdit.Demo/MainWindow.xaml
+++ b/src/AvaloniaEdit.Demo/MainWindow.xaml
@@ -34,6 +34,7 @@
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Visible"
FontWeight="Light"
+ LineNumbersMargin="10,0,20,0"
FontSize="14" />
\ No newline at end of file
diff --git a/src/AvaloniaEdit/TextEditor.cs b/src/AvaloniaEdit/TextEditor.cs
index 5d12a549..d350e12c 100644
--- a/src/AvaloniaEdit/TextEditor.cs
+++ b/src/AvaloniaEdit/TextEditor.cs
@@ -541,7 +541,9 @@ private static void OnShowLineNumbersChanged(AvaloniaPropertyChangedEventArgs e)
leftMargins.Insert(0, lineNumbers);
leftMargins.Insert(1, line);
var lineNumbersForeground = editor.GetBindingObservable(LineNumbersForegroundProperty);
+ var lineNumbersMargin = editor.GetBindingObservable(LineNumbersMarginProperty);
line.Bind(Shape.StrokeProperty, lineNumbersForeground);
+ line.Bind(MarginProperty, lineNumbersMargin);
lineNumbers.Bind(ForegroundProperty, lineNumbersForeground);
}
else
@@ -608,6 +610,23 @@ private static void SearchResultsBrushChangedCallback(AvaloniaPropertyChangedEve
}
#endregion
+
+ #region LineNumbersMargin
+ ///
+ /// LineNumbersMargin dependency property.
+ ///
+ public static readonly StyledProperty LineNumbersMarginProperty =
+ AvaloniaProperty.Register("LineNumbersMargin", new Thickness(2, 0, 2, 0));
+
+ ///
+ /// Gets or sets the margin that is used to display the vertical line to the right of the line numbers.
+ ///
+ public Thickness LineNumbersMargin
+ {
+ get => GetValue(LineNumbersMarginProperty);
+ set => SetValue(LineNumbersMarginProperty, value);
+ }
+ #endregion
#region TextBoxBase-like methods
///