Search code examples
c#wpfxamlwrappanel

WPF WrapPanel collapsing order


Does anyone know how to set order of WrapPanel collapse (or if it is even possible)? I want to collapse the outer WrapPanel before the inner one. To make it harder I have inner WrapPanel inside Expander.

<WrapPanel>
            <Button Style="{StaticResource ExchangeButton}"  />
            <Expander ExpandDirection="Right" Header="Edition"
                      Template="{StaticResource ExpanderTemplate}">
                <WrapPanel>
                    <Button Style="{StaticResource AddButton}"  />
                    <Button Style="{StaticResource EditButton}"  />
                    <Button Style="{StaticResource DeleteButton}"  />
                </WrapPanel>
            </Expander>
</WrapPanel>

Solution

  • Hiding or Collapsing a parent container will do the same for all its children. and their children...

    This is a good thing. Think about this from the other direction...if your inner container was Visible, but the outer was Hidden, there would be no way to interact with it despite its state being visible. WPF takes care of all this for you and makes creating a UI that shows, hides, or collapses content easy and controllable from the highest level.