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 del controllo BulletDecorator.
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à
Il colore di sfondo per il Bullet e Child di un BulletDecorator. Il valore predefinito è null
.
Esempio
Negli esempi seguenti viene illustrato come impostare la Background proprietà su 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 l'oggetto può estendersi oltre Bullet il BulletDecorator relativo contenuto eChild. Ad esempio, se è BulletDecorator il singolo figlio di una cella in un Grid controllo, la Background proprietà si applica all'intera cella. Ciò si verifica perché il contenuto in una Grid cella viene esteso in tutte le direzioni per riempire la cella, per impostazione predefinita. Tuttavia, se si imposta la proprietà su per , la VerticalAlignmentBackground proprietà influisce solo sull'area BulletDecoratordel contenuto effettiva dell'oggetto BulletDecorator.Center In alternativa, è possibile racchiudere l'oggetto BulletDecorator in un Panel elemento.
Informazioni proprietà di dipendenza
Campo Identificatore | BackgroundProperty |
Proprietà dei metadati impostate su true |
AffectsRender, SubPropertiesDoNotAffectRender |
Si applica a
Vedi anche
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per