Is it possible to style a BulletDecorator in WPF?
BulletDecorator.Bullet cannot be styled, and BulletDecorator is not a Control so it can't be templated.
However you can get the effect in pure XAML by defining a ControlTemplate for ContentControl like this:
<ControlTemplate x:Key="BulletTemplate" TargetType="{x:Type ContentControl}">
<BulletDecorator>
<BulletDecorator.Bullet>
...my bullet UIElement here...
</BulletDecorator.Bullet>
<ContentPresenter />
</BulletDecorator>
</ControlTemplate>
Now you can use it like this:
<ContentControl Template="{StaticResource BulletTemplate}">
<TextBlock />
</ContentControl>
If you only use it a few times, the "<ContentControl Template=..." technique works fine. If you are going to use it more often, you can define a MyBullet class:
public class MyBullet : ContentControl
{
static MyBullet()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MyBullet), new FrameworkPropertyMetadata(typeof(MyBullet));
}
}
then move your ControlTemplate into Theme/Generic.xaml (or a dictionary merged into it) and wrap it with this:
<Style TargetType="{x:Type local:MyBullet}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate
...
</Setter.Value>
</Setter>
</Style>
If you do this, you can use:
<local:MyBullet>
<TextBox />
</local:MyBullet>
anywhere in your application.
Bullet is not a dependency property, so it can't be styled.
But you could of course declare your own classes that derive from Decorator and set the Bullet in the constructor, so you could write:
<local:MyDecorator>
<TextBlock />
</local:MyDecorator>