سؤال

In my app it has a Grid Row with only an expander in it. What I want is for this Grid/Expander to be shown when the expander is expanded but hidden when not. I figured putting the height of the expander to 0 and the height of the Grid.Row to Auto would fix this. Problem is that when this is done the expander no longer expands.

Thanks for the help

Edit: Thanks to @Blam he solved the problem with this;

<Expander.Style>
<Style TargetType="Expander">
    <Setter Property="Visibility" Value="Collapsed"/>
    <Style.Triggers>
        <Trigger Property="IsExpanded" Value="True">
            <Setter Property="Visibility" Value="Visible"/>
        </Trigger>
    </Style.Triggers>
</Style>
</Expander.Style>

Although did cause another minor issue to occur. I had an animation on the expander, when expanding the animation shows. Although on collapsing the animation does not. I am assuming the visibility property is effect instantly therefore no time is given for the animation.

Is there a way to put a delay in this property?

هل كانت مفيدة؟

المحلول

Set the Expander Visibility to Collapsed

I would try putting the Visibility in the Expander Collapsed event

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top