Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个非常简单的 WP7 应用程序只是为了好玩。我的视图上有一个文本框,当我单击它时,背景颜色变为白色。由于文本前景也是白色的,因此文本不显示。有没有办法覆盖这种默认样式?
如果我正确理解了问题,您可以在 GotFocus 事件上更改 TextBox 的背景和前景画笔,如下所示:
private void textBox1_GotFocus(object sender, RoutedEventArgs e) { textBox1.Background = new SolidColorBrush(Colors.Blue); textBox1.Foreground = new SolidColorBrush(Colors.Yellow); }