0

I'm attempting to extend a RichTextBox, so as to add some extra functionality; however, I'm running into a strange issue with the background color of my extended RTB. Here is the code:

RichTextBoxExtended.cs

public class RichTextBoxExtended: RichTextBox
{
    // completely empty
}

MyView.xaml

<UserControl x:Class="MyNamespace.MyView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid>
        <RichTextBoxExtended />
    </Grid>
</UserControl>

However, when showing this in a WPF page, the background color of the text box is gray, as if it were disabled (which it isn't, since I can still type into it fine). As a test, I replaced <RichTextBoxExtended /> in the XAML with <RichTextBox />, and that control is white as expected.

Does anyone know what could cause this issue? I can easily work around the problem by manually setting the background color to white, but am looking for a better solution.

Chris Covert
  • 2,684
  • 3
  • 24
  • 31

1 Answers1

1

I just copy paste your code to a test solution, place a frame in main window and put the RichTextBoxExtended in a page inside the frame, but the background of RTB is completely white. I think there is something else causing the problem.

Mike Mackintosh
  • 13,917
  • 6
  • 60
  • 87
Bahman_Aries
  • 4,658
  • 6
  • 36
  • 60