What's the correct way to style the LineNumberMargin? #395
-
Beta Was this translation helpful? Give feedback.
Answered by
NickRimmer
Mar 6, 2024
Replies: 1 comment 2 replies
-
Dirty solution to override vertical line, but this is a hack and can stop working with future Editor updates if (_textEditor.TextArea.LeftMargins.Count >= 2 && _textEditor.TextArea.LeftMargins[1] is Line)
{
var line = new Line
{
StartPoint = new Point(0, 0),
EndPoint = new Point(0, 1),
StrokeDashArray = new AvaloniaList<double> { 0, 2 },
Stretch = Stretch.Fill,
StrokeThickness = 1,
StrokeLineCap = PenLineCap.Round,
Margin = new Thickness(10, 0, 20, 0),
Tag = Tag
};
_textEditor.TextArea.LeftMargins.RemoveAt(1);
_textEditor.TextArea.LeftMargins.Insert(1, line);
var lineNumbersForeground = new Binding("LineNumbersForeground") { Source = _textEditor };
line.Bind(Shape.StrokeProperty, lineNumbersForeground);
} Tested with Demo project |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Max-H-0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dirty solution to override vertical line, but this is a hack and can stop working with future Editor updates