BulletDecorator.Background Özellik

Tanım

Denetimin BulletDecorator arka plan rengini alır veya ayarlar.

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

Özellik Değeri

ve BulletChildiçin BulletDecorator arka plan rengi. Varsayılan değer: null.

Örnekler

Aşağıdaki örneklerde bir denetimde Background özelliğinin BulletDecorator nasıl ayarlanacağı gösterilmektedir.

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>

Açıklamalar

Background özelliği içindeki alanı Brushdoldurmak için kullanılacak öğesini tanımlarBulletDecorator. Bazı üst düzen öğeleri için, için BulletDecorator tanımlanan alan ve Bullet içeriğinin ötesine Child uzanabilir. Örneğin, denetimindeki bir hücrenin BulletDecorator tek alt öğesiyseGrid, Background özelliği tüm hücreye uygulanır. Bunun nedeni, hücredeki Grid içeriğin varsayılan olarak hücreyi doldurmak için tüm yönlere genişletilmesidir. Ancak için özelliğini VerticalAlignmentCenterBulletDecoratorolarak ayarlarsanızBackground, özelliği yalnızca öğesinin gerçek içerik alanını BulletDecoratoretkiler. Alternatif olarak, öğesini bir BulletDecorator öğenin içine alabilirsinizPanel.

Bağımlılık Özelliği Bilgileri

Öğe Değer
Tanımlayıcı alanı BackgroundProperty
Meta veri özellikleri olarak ayarlandı true AffectsRender, SubPropertiesDoNotAffectRender

Şunlara uygulanır

Ayrıca bkz.