BulletDecorator Class

Represents a layout control that aligns a "bullet" and another visual object.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public class BulletDecorator : Decorator
public class BulletDecorator extends Decorator
public class BulletDecorator extends Decorator

Content Model: BulletDecorator is a Decorator element, and has two content properties: Bullet and Child. The Bullet property defines the UIElement to use as a bullet. The Child property defines a UIElement that visually aligns with the bullet.

A BulletDecorator control consists of a Bullet, such as an Image, CheckBox, or RadioButton, followed by a UIElementChild object, such as a text string. The BulletDecorator aligns the Bullet with the Child and automatically updates the alignment between them if their properties change.

A Bullet always aligns with the first line of text when the Child object is a text object. If the Child object is not a text object, the Bullet aligns to the center of the Child object. For more information about layout of a BulletDecorator, see How to: Create a BulletDecorator.

If the Bullet is a CheckBox or RadioButton, the user can click the Bullet or the Child to toggle the state of the CheckBox or RadioButton.

A BulletDecorator can only contain one element, in addition to the Bullet element. If a BulletDecorator contains more than one element and a Bullet, an InvalidOperationException occurs at run time.

The following illustration shows examples of BulletDecorator controls.

BulletDecorator styles

The following examples show how to define a BulletDecorator control.

<BulletDecorator  Grid.Row="1" Grid.Column="0" Margin="0,5,0,0"
                  VerticalAlignment="Center" Background="Yellow">
    <Image Source="images\apple.jpg"/>
    Foreground ="Purple">
    A Simple BulletDecorator

BulletDecorator myBulletDecorator = new BulletDecorator();
Image myImage = new Image();
BitmapImage myBitmapImage = new BitmapImage();
myBitmapImage.UriSource = new Uri(@"pack://application:,,/images/apple.jpg");
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;


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions