BulletDecorator.Background Eigenschap

Definitie

Hiermee haalt u de achtergrondkleur voor een BulletDecorator besturingselement op of stelt u deze in.

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

Waarde van eigenschap

De achtergrondkleur voor en BulletChild van een BulletDecorator. De standaardwaarde is null.

Voorbeelden

In de volgende voorbeelden ziet u hoe u de Background eigenschap voor een BulletDecorator besturingselement instelt.

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>

Opmerkingen

De Background eigenschap definieert het Brush te gebruiken gebied in het gebied in te BulletDecoratorvullen. Voor sommige bovenliggende indelingselementen kan het gebied dat is gedefinieerd voor het BulletDecorator gebied, verder gaan dan Bullet de inhoud.Child Als het BulletDecorator één onderliggende element van een cel in een Grid besturingselement is, is de Background eigenschap bijvoorbeeld van toepassing op de hele cel. Dit komt doordat de inhoud in een Grid cel standaard in alle richtingen wordt uitgerekt om de cel te vullen. Als u de VerticalAlignment eigenschap echter instelt voor de Centereigenschap, is de BulletDecorator eigenschap alleen van invloed op het werkelijke inhoudsgebied van het BackgroundBulletDecorator . U kunt ook het BulletDecorator element insluiten Panel .

Informatie over afhankelijkheidseigenschappen

Item Waarde
Id-veld BackgroundProperty
Eigenschappen van metagegevens ingesteld op true AffectsRender, SubPropertiesDoNotAffectRender

Van toepassing op

Zie ook