Panel.Background Properti

Definisi

Mendapatkan atau mengatur Brush yang digunakan untuk mengisi area di antara batas Panel.

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

Nilai Properti

Brush. Nilai default ini adalah null.

Contoh

Contoh berikut mengatur Background dari ke GridRadialGradientBrush.

<Grid>
  <Grid.Background>
    <RadialGradientBrush 
        GradientOrigin="0.5,0.5" 
        Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
      <RadialGradientBrush.GradientStops>
        <GradientStop Color="Yellow" Offset="0" />
        <GradientStop Color="Red" Offset="0.25" />
        <GradientStop Color="Blue" Offset="0.75" />
        <GradientStop Color="Green" Offset="1" />
      </RadialGradientBrush.GradientStops>
    </RadialGradientBrush>
  </Grid.Background>
</Grid>

Keterangan

Panel elemen tidak menerima peristiwa mouse atau stylus jika Background tidak ditentukan. Jika Anda perlu menangani peristiwa mouse atau stylus tetapi tidak ingin latar belakang untuk Anda Panel, gunakan Transparent.

Informasi Properti Dependensi

Barang Nilai
Bidang pengidentifikasi BackgroundProperty
Properti metadata diatur ke true AffectsRender, SubPropertiesDoNotAffectRender

Berlaku untuk

Lihat juga