How can I make an “Accordion Widget” in WPF?

后端 未结 2 2021
一向
一向 2020-12-31 23:58

The goal:

I\'m trying to achieve something like this in WPF:


(source: wordpress.org)


An initial solu

相关标签:
2条回答
  • 2021-01-01 00:33

    You're not seeing the Expander because you redefined its template. This one should work better :

            ...
            <Expander.Template>
              <ControlTemplate
                  TargetType="Expander">
                  <Border
                      BorderThickness="1">
                      <Expander Content="{TemplateBinding Content}" Header="{TemplateBinding Header}"/>
                  </Border>
              </ControlTemplate>
            </Expander.Template>
            ...
    
    0 讨论(0)
  • 2021-01-01 01:00

    Personally I think a TreeView control would give you a much better base to work from, especially if you're using Expression Blend as a basis to create new/blank Templates from for items. Seeing the default Templates is extremely enlightening and gives you much more fine-grained control and better understanding and insight into how things work by default. Then you can go to town on them. It also looks like you're working with Hierchical Data and TreeViews inherently lend themselves well to working with such data.

    0 讨论(0)
提交回复
热议问题