2012-04-02 15 views
2

wpfのエキスパンダーの例に従った。うまく動作しますが、古い箇条書きはまだ新しい箇条書きを覆い隠しています。次のようにコードは次のとおりです。エキスパンダーの古い箇条書きがまだ表示されている

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

答えて

0

私はそれをworkarround見つけました。

<BulletDecorator.Bullet> 
     <Image Width="50" Source="Flowers.jpg" Margin="-20,0,0,0"/> 
</BulletDecorator.Bullet> 

必要に応じて-20の余白を入れて、古い弾丸をカバーします。私はそれがそれを行うための正しい方法ではないが、それは私のために働いた知っている。

2

Expander制御用ControlTemplateは、そのコンテンツHeaderプロパティにバインドされたテンプレートですToggleButtonを定義します。このToggleButtonはまた、Ellipse(および矢印はPathとして表される)およびContentPresenterHeaderの内容を含む)の2つの列があるように定義されたControlTemplateを有する。

この動作を変更するには、ExpanderTemplateプロパティを再定義する必要があります。

関連する問題