Search code examples
.netwpfxamlwpf-controlsexpander

Expander old bullet still showing


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>

Solution

  • 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.