views:

25

answers:

1

In Windows Phone 7, a textbox with IsReadOnly property is set to true, when it runs (at least in the Beta emulator), even with Background color set to Black and Foreground color set to White, the background remains gray with the foreground chars a lighter gray. I need to change this so it is readable!

So is there a way to override this?

I've tried setting it to something else in the textbox load event, but it hasn't worked. Apparently setting ReadOnly to true sets the fore/background colors in stone.

Here would be some code to change the colors, if they could be changed:

SolidColorBrush ForeBrush = new SolidColorBrush();
SolidColorBrush BackBrush = new SolidColorBrush();
ForeBrush.Color = Colors.White;
BackBrush.Color = Colors.Black;
txtFrom.Foreground = ForeBrush;
txtFrom.Background = BackBrush;
+1  A: 

I think that template of textbox contains visual style for read-only textbox. Therefore you can't set other style. But you can try to change template for textbox also as any other silverlight control:

<TextBox ..>
  <TextBox.Template>
    ...
  </TextBox.Template>
</TextBox>
Sergey Zwezdin
The best that I can tell is that this is correct, that the ReadOnly style cannot be overridden -- I've had suggestions to use Blend to do it, but I couldn't even make Blend do it. In the event, I ended up going another route and writing a custom control to do what I wanted.
Cyberherbalist