WPF code:
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;
XAML code:
<BulletDecorator Margin="0,5,0,0">
<BulletDecorator.Bullet>
<CheckBox/>
</BulletDecorator.Bullet>
<TextBlock
Width="100"
TextWrapping="Wrap"
HorizontalAlignment="Left"
Foreground = "Blue"
Margin="5,0,0,0">
A BulletDecorator with a CheckBox Bullet.
</TextBlock>
</BulletDecorator>
<BulletDecorator Margin="0,5,0,0">
<BulletDecorator.Bullet>
<TextBox Width="30"/>
</BulletDecorator.Bullet>
<TextBlock
Width="100"
TextWrapping="Wrap"
HorizontalAlignment="Left"
Foreground ="Blue"
Margin="5,0,0,0">
A BulletDecorator with a TextBox Bullet.
</TextBlock>
</BulletDecorator>
<BulletDecorator Margin="0,5,0,0">
<BulletDecorator.Bullet>
<RadioButton/>
</BulletDecorator.Bullet>
<TextBlock
Width="100"
TextWrapping="Wrap"
HorizontalAlignment="Left"
Foreground ="Blue"
Margin="5,0,0,0">
A BulletDecorator with a RadioButton Bullet
</TextBlock>
</BulletDecorator>