Hi everyone,
I am using control template to change all the textboxes' style in specific Grid, all textboxes outside the Grid will have different style
I works fine with the following code, but I need one more enhancement
I would like to change a textbox's borderbrush to red when a button click, however, since I am set the color to Blue in style, the code textBox1.BorderBrush = Brushes.Red; is not working
How to modify the controlTemplate that normal style is Blue border and when a button is clicked, the code textBox1.BorderBrush = Brushes.Red; can change the border to Red?
Thanks
Ivan
Here are my codes:
XAML:
Code Behind:
private void button1_Click(object sender, RoutedEventArgs e)
{
textBox1.BorderBrush = Brushes.Red;
}
ivan ivanPosted Dec 11, 2013, 8:22 PM
The following code solve my problem