Bip
Bip

Reputation: 913

windows phone - textbox background

I have Textbox with blue Background and white Foreground. When entering a text my whole Textbox becomes white and i cannot see what i am typing because im writing white letters on white background. How to change background of a textbox when writing to i.e. blue?

Upvotes: 3

Views: 3551

Answers (2)

Cameron
Cameron

Reputation: 430

A much better way to do this is to directly edit the focused style in expression blend. This tutorial will help you out.

http://www.windowsphonegeek.com/tips/wp7-textbox-light-theme-problems-the-solution

Upvotes: 4

nkchandra
nkchandra

Reputation: 5557

Add the GotFocus event handler to the TextBox like this.

private void TextBox_GotFocus(object sender, RoutedEventArgs e)
    {
        (sender as TextBox).Background = new SolidColorBrush(Colors.Blue);
    }

Upvotes: 6

Related Questions