Reputation: 1183
I followed an example of expander in wpf. Works fine but old bullet is still showing besise the new bullet. The code is as follows:
<Expander Name="ExpanderControl"
HorizontalAlignment="Left" Background="LavenderBlush"
ExpandDirection="Down" IsExpanded="False" Width="250"
FontSize="20" FontWeight="Bold" Foreground="Green" >
<Expander.Header>
<BulletDecorator>
<BulletDecorator.Bullet>
<Image Width="50" Source="Flowers.jpg"/>
</BulletDecorator.Bullet>
<TextBlock Margin="20,0,0,0">Flower Header</TextBlock>
</BulletDecorator>
</Expander.Header>
<TextBlock TextWrapping="Wrap" FontSize="14" FontWeight="Light" Foreground="Black">
This is an Expander control. Within this control, all contents will be wrapped.
At run-time, you may expand or collapse this control. Type more text here to be
Jump around and hype.
</TextBlock>
</Expander>
Upvotes: 2
Views: 506
Reputation: 1183
I found a workarround it.
<BulletDecorator.Bullet>
<Image Width="50" Source="Flowers.jpg" Margin="-20,0,0,0"/>
</BulletDecorator.Bullet>
Put a margin of -20 of according to your need and it will cover the old bullet. I know it is not the right way for doing it but it worked for me.
Upvotes: 0
Reputation: 3285
The ControlTemplate
for the Expander
control defines a ToggleButton
whose Content is template bound to the Header
property. This ToggleButton
also has a ControlTemplate
defined in such a way that there are 2 columns: one for the Ellipse
(and arrow represented as a Path
), and one for the ContentPresenter
(which hosts the Header
content).
To change this behaviour, you will need to redefine the Template
property on the Expander
.
Upvotes: 2