BulletDecorator.Background Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta il colore di sfondo per un BulletDecorator controllo .
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
Valore della proprietà
Colore di sfondo per e BulletChild di un oggetto BulletDecorator. Il valore predefinito è null.
Esempio
Negli esempi seguenti viene illustrato come impostare la Background proprietà in un BulletDecorator controllo .
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>
Commenti
La Background proprietà definisce l'oggetto Brush da utilizzare per riempire l'area all'interno di BulletDecorator. Per alcuni elementi di layout padre, l'area definita per può BulletDecorator estendersi oltre il contenuto Bullet e Child . Ad esempio, se BulletDecorator è il singolo elemento figlio di una cella di un Grid controllo, la Background proprietà si applica all'intera cella. Ciò si verifica perché il contenuto di una Grid cella viene esteso in tutte le direzioni per riempire la cella, per impostazione predefinita. Tuttavia, se si imposta la VerticalAlignment proprietà su Center per BulletDecorator, la Background proprietà influisce solo sull'area di contenuto effettiva dell'oggetto BulletDecorator. In alternativa, è possibile racchiudere in BulletDecorator un Panel elemento .
Informazioni sulle proprietà di dipendenza
| Elemento | Valore |
|---|---|
| Campo Identificatore | BackgroundProperty |
Proprietà dei metadati impostate su true |
AffectsRender, SubPropertiesDoNotAffectRender |