如何从代码隐藏中更改边框背景?

问题描述 投票:0回答:1

如何从代码后面将边框背景更改为红色?

<Border Name="border_c"
           HorizontalAlignment="Left"
           VerticalAlignment="Top"
           CornerRadius="10" Width="180" Background="green">
c# wpf
1个回答
0
投票

试试这个..


using System.Windows.Media;

Border border = border_c;
SolidColorBrush redBrush = new SolidColorBrush(Colors.Red);
border.Background = redBrush;


border_c.Background = Brushes.Red;

© www.soinside.com 2019 - 2024. All rights reserved.