Unpopulate StackView when item is not enabled

APOLOGIES: This should have been posted in the How-To catagory.

Hi there,

I’m using a HidingPanel and to display different items in a StackView based on what type of user the current logged in user is.

My HidingPanel class looks like this:

<Panel ux:Class="HidingPanel" Opacity="0" IsEnabled="false" HitTestMode="LocalBoundsAndChildren">
	<WhileEnabled>
		<Change this.Opacity="1" Duration="0.2" />
	</WhileEnabled>
</Panel>

And when using this in a StackView I get these two different scenarios:

Instead of having the gap in the StackView where the HidingPanel is not enabled, how would I fill this space dependent on whether I want the panel to be shown?

Thanks

It’s hard to suggest a solution without having a complete, minimal reproduction that we could test.

That said, I think that instead of changing the Opacity you should toggle Visibility of the element. Visibility="Collapsed" makes the element to take up 0 space, Visibility="Hidden" hides it but still reserves the space, and Visibility="Visible" shows the element.

That’s all I needed,

Thanks!