次の方法で共有


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

プロパティ値

Brush

BulletChild および 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。 一部の親レイアウト要素の場合、定義されている領域は、そのBullet領域とChildコンテンツのBulletDecorator範囲を超えて拡張される場合があります。 たとえば、コントロール内GridBulletDecoratorセルの 1 つの子である場合、プロパティはBackgroundセル全体に適用されます。 これは、既定では、セル内の Grid コンテンツがセルを塗りつぶすためにすべての方向に引き伸ばされるために発生します。 ただし、プロパティを 〗に設定した場合、プロパティは Background 〗の実際のコンテンツ領域にのみ影響しますBulletDecoratorCenter BulletDecoratorVerticalAlignment または、要素でBulletDecoratorPanel囲むことができます。

依存プロパティ情報

識別子フィールド BackgroundProperty
に設定されたメタデータ プロパティ true AffectsRender, SubPropertiesDoNotAffectRender

適用対象

こちらもご覧ください