Border.Background 属性

定义

获取或设置 Brush,它填充 Border 边界之间的区域。

public:
 property System::Windows::Media::Brush ^ Background { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
public System.Windows.Media.Brush Background { get; set; }
member this.Background : System.Windows.Media.Brush with get, set
Public Property Background As Brush

属性值

绘制背景的 Brush。 此属性没有默认值。

示例

以下示例演示如何使用可扩展应用程序标记语言 (XAML) 和代码设置 属性的值 Background

myBorder1 = new Border();
myBorder1.BorderBrush = Brushes.SlateBlue;
myBorder1.BorderThickness = new Thickness(5, 10, 15, 20);
myBorder1.Background = Brushes.AliceBlue;
myBorder1.Padding = new Thickness(5);
myBorder1.CornerRadius = new CornerRadius(15);
Dim myBorder1 As New Border()
myBorder1.BorderBrush = Brushes.SlateBlue
myBorder1.BorderThickness = New Thickness(5, 10, 15, 20)
myBorder1.Background = Brushes.AliceBlue
myBorder1.Padding = New Thickness(5)
myBorder1.CornerRadius = New CornerRadius(15)
<Border BorderBrush="SlateBlue" BorderThickness="5,10,15,20" Background="AliceBlue" Padding="5" CornerRadius="15">

注解

依赖项属性信息

标识符字段 BackgroundProperty
元数据属性设置为 true AffectsRender, SubPropertiesDoNotAffectRender

适用于