如何从代码后面将边框背景更改为红色?
<Border Name="border_c"
HorizontalAlignment="Left"
VerticalAlignment="Top"
CornerRadius="10" Width="180" Background="green">
试试这个..
using System.Windows.Media;
Border border = border_c;
SolidColorBrush redBrush = new SolidColorBrush(Colors.Red);
border.Background = redBrush;
或
border_c.Background = Brushes.Red;