Skip to content

What's the correct way to style the LineNumberMargin? #395

Answered by NickRimmer
Max-H-0 asked this question in Q&A
Discussion options

You must be logged in to vote

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 B…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@NickRimmer
Comment options

@Max-H-0
Comment options

Answer selected by Max-H-0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants