Have you seen the BulletDecorator ?

So I was working on a fancy-ish tooltip (see my previous post). I wanted it to display a bold header and other information in a bullet point fashion underneath. Whilst researching how to do this I came across the BulletDecorator.

There’s so much in WPF, I’m always finding new things or just different ways to do the same thing. This doesn’t really (from what I can see) do anything fantastically clever or the likes, but it’s sort of nice and descriptive in the XAML as to the intent.

So to use the decorator we wrap the control we want to act as the bullet in the Bullet property and the content as a child of the control thus

<BulletDecorator>
   <BulletDecorator.Bullet>
      <Ellipse Height="5" Width="5" Fill="Blue"/>
   </BulletDecorator.Bullet>
   <TextBlock Text="Item1" Margin="3,0,0,0"/>
</BulletDecorator>

Now it’s most likely if you have one bullet point you’ll want several. So an easy way to apply the “style” is as follows.

Create a ControlTemplate in the Resources section of your control (or wherever) that looks something like this

<ControlTemplate x:Key="BulletTemplate" TargetType="{x:Type ContentControl}">
   <BulletDecorator>
      <BulletDecorator.Bullet>
         <Ellipse Height="5" Width="5" Fill="Blue"/>
      </BulletDecorator.Bullet>
      <ContentPresenter Margin="3,0,0,0"/>
   </BulletDecorator>
</ControlTemplate>

Now in your XAML write this instead of the original code

<ContentControl Template="{StaticResource BulletTemplate}">
   <TextBlock Text="Item1" />
</ContentControl>

References

BulletDecorator Class