BulletDecorator Class
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
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.
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"> <BulletDecorator.Bullet> <Image Source="images\apple.jpg"/> </BulletDecorator.Bullet> <TextBlock Width="100" TextWrapping="Wrap" HorizontalAlignment="Left" Foreground ="Purple"> A Simple BulletDecorator </TextBlock> </BulletDecorator>
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
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Media.Visual
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Decorator
System.Windows.Controls.Primitives.BulletDecorator
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.