How to implement RichTextBox or Avalonedit with RuleLine (muted lines) in WPF

52 Views Asked by At

I wanna implement an editor that requires drawing RuleLines(Muted lins?) per line like the ones in the image below. I'm going to use RichTextBox or AvalonEdit.

Can you help me creating this pattern? Thanks in advance..

enter image description here

2

There are 2 best solutions below

1
Jackdaw On BEST ANSWER

In WPF RichTextBox you can set border thickness for the Paragraph style. It will look like on your screenshot.

<RichTextBox x:Name="richtextbox" >   
    <RichTextBox.Resources>
        <Style TargetType="{x:Type Paragraph}">
            <Setter Property="BorderThickness" Value="0,0,0,1"></Setter>
            <Setter Property="BorderBrush" Value="#388FFA"></Setter>
            <Setter Property="Margin" Value="3"/>
            <Setter Property="Padding" Value="2"/>
        </Style>
    </RichTextBox.Resources>
</RichTextBox>

enter image description here

1
sodiseng On

I've done it in AvalonEdit by myself. add RulerLines(just need drawline via DrawingContext) class when VisualLine or TextView Rendering. Image Done