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.