Bagikan melalui


BulletDecorator.Background Properti

Definisi

Mendapatkan atau mengatur warna latar belakang untuk BulletDecorator kontrol.

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

Warna latar belakang untuk Bullet dan Child dari BulletDecorator. Default adalah null.

Contoh

Contoh berikut menunjukkan cara mengatur Background properti pada BulletDecorator kontrol.

BulletDecorator myBulletDecorator = new BulletDecorator();
Image myImage = new Image();
BitmapImage myBitmapImage = new BitmapImage();
myBitmapImage.BeginInit();
myBitmapImage.UriSource = new Uri(@"pack://application:,,/images/apple.jpg");
myBitmapImage.EndInit();
myImage.Source = myBitmapImage;
myImage.Width = 10;
myBulletDecorator.Bullet = myImage;
myBulletDecorator.Margin = new Thickness(0, 10, 0, 0);
myBulletDecorator.VerticalAlignment = VerticalAlignment.Center;
myBulletDecorator.Background = Brushes.Yellow;
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "This BulletDecorator created by using code";
myTextBlock.TextWrapping = TextWrapping.Wrap;
myTextBlock.HorizontalAlignment = HorizontalAlignment.Left;
myTextBlock.Width = 100;
myTextBlock.Foreground = Brushes.Purple;
myBulletDecorator.Child = myTextBlock;
Dim myBulletDecorator = New BulletDecorator()
Dim myImage = New Image()
Dim myBitmapImage = New BitmapImage()
myBitmapImage.BeginInit()
myBitmapImage.UriSource = _
   New Uri("pack://application:,,/images/apple.jpg")
myBitmapImage.EndInit()
myImage.Source = myBitmapImage
myImage.Width = 10
myBulletDecorator.Bullet = myImage
myBulletDecorator.Margin = New Thickness(0, 10, 0, 0)
myBulletDecorator.VerticalAlignment = VerticalAlignment.Center
myBulletDecorator.Background = Brushes.Yellow
Dim myTextBlock = New TextBlock()
myTextBlock.Text = "This BulletDecorator created by using code"
myTextBlock.TextWrapping = TextWrapping.Wrap
myTextBlock.HorizontalAlignment = HorizontalAlignment.Left
myTextBlock.Width = 100
myTextBlock.Foreground = Brushes.Purple
myBulletDecorator.Child = myTextBlock
<BulletDecorator  Grid.Row="1" Grid.Column="0" Margin="0,5,0,0"
                  VerticalAlignment="Center" Background="Yellow">
  <BulletDecorator.Bullet>
    <Image Source="images\apple.jpg"/>
  </BulletDecorator.Bullet>
  <TextBlock
    Width="100" 
    TextWrapping="Wrap" 
    HorizontalAlignment="Left"
    Foreground ="Purple">
    A Simple BulletDecorator
  </TextBlock>
</BulletDecorator>

Keterangan

Properti Background mendefinisikan Brush untuk digunakan untuk mengisi area dalam BulletDecorator. Untuk beberapa elemen tata letak induk, area yang ditentukan untuk BulletDecorator mungkin melampaui konten dan Child .Bullet Misalnya, jika BulletDecorator adalah anak tunggal dari sel dalam Grid kontrol, Background properti berlaku untuk seluruh sel. Ini terjadi karena konten dalam Grid sel direntangkan ke semua arah untuk mengisi sel, secara default. Namun, jika Anda mengatur VerticalAlignment properti ke Center untuk BulletDecorator, Background properti hanya memengaruhi area konten aktual dari BulletDecorator. Atau, Anda dapat mengapit BulletDecorator dalam Panel elemen .

Informasi Properti Dependensi

Bidang pengidentifikasi BackgroundProperty
Properti metadata diatur ke true AffectsRender, SubPropertiesDoNotAffectRender

Berlaku untuk

Lihat juga