tolsen64
tolsen64

Reputation: 999

How to get rid of (or match color of) space between RichTextBox and adjacent image

So I have the following XAML:

<DockPanel Name="dpSchedItem" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" LastChildFill="True">
    <Image DockPanel.Dock="Right" Height="17" Width="17" VerticalAlignment="Top" HorizontalAlignment="Right" Cursor="Hand" Margin="0,0,0,0" Source="Resources\Pencil_Gray.png" MouseUp="Image_MouseUp" />
    <RichTextBox DockPanel.Dock="Left" Name="rtbText" Margin="0,0,0,0" VerticalScrollBarVisibility="Auto" BorderThickness="0" BorderBrush="Transparent" IsReadOnly="True" />
</DockPanel>

And I add content to the RichTextBox in code:

rtbText.BorderBrush = BackgroundColor
Dim p As New Paragraph
p.Inlines.Add(New Bold(New Run(SO & If(Title = "", "", " - " & Title))))
rtbText.Document = New FlowDocument(p) With {.Background = BackgroundColor, .PagePadding = New Thickness(0.0)}

But it's rendered like this:

Rendered

I tried overriding the control template like it shows here for a button, but the RTB doesn't have the same content property. From another post I got the idea to set the PagePadding thickness to 0 for the FlowDocument, but that didn't get the results I wanted.

I want that space (border or margin, or whatever it is) to be green like everything else.

Upvotes: 1

Views: 43

Answers (1)

ΩmegaMan
ΩmegaMan

Reputation: 31656

It is unclear if the holding grid/page is green but make the controls background color Transparent until a full green is achieved such as:

<DockPanel Background="Transparent"...>
   <RichTextBox Background="Transparent" BorderBrush="Transparent" ...>

Or make the DockPanel's background Green and the RichTextBox Background Transparent.

Upvotes: 1

Related Questions