BulletDecorator.Background Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает цвет фона для элемента управления 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
Значение свойства
Цвет фона для Bullet и Child элемента BulletDecorator. Значение по умолчанию — null
.
Примеры
В следующих примерах показано, как задать Background свойство элемента BulletDecorator управления.
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>
Комментарии
Свойство Background определяет Brush использование для заполнения области в пределах области BulletDecorator. Для некоторых родительских элементов макета область, определенная для нее BulletDecorator и Child содержимого, может быть расширенаBullet. Например, если BulletDecorator элемент является одним дочерним элементом ячейки в элементе Grid управления, Background свойство применяется ко всей ячейке. Это происходит потому, что содержимое ячейки Grid растягивается во всех направлениях для заполнения ячейки по умолчанию. Однако если для свойства BulletDecoratorCenter задано VerticalAlignment значение, Background свойство влияет только на фактическую область содержимого BulletDecoratorобъекта . Кроме того, можно заключить BulletDecorator его в Panel элемент.
Сведения о свойстве зависимостей
Поле идентификатора | BackgroundProperty |
Metadata properties set to true |
AffectsRender, SubPropertiesDoNotAffectRender |