共用方式為


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。 此屬性沒有預設值。

範例

下列範例示範如何使用 Extensible Application Markup Language (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

適用於