sodiseng
sodiseng

Reputation: 23

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

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

Upvotes: -1

Views: 104

Answers (2)

sodiseng
sodiseng

Reputation: 23

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

Upvotes: 0

Victor
Victor

Reputation: 8985

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

Upvotes: 0

Related Questions