Expand/Collapse

I have expand/collapse functionality implemented that works perfectly in the simulator but crashes any device I try to run it on. I think I’ve narrowed the issue down to the StackPanel I’m using and guessing I’m not using it the way it was intended, so hoping for some advice on other approaches I might be able to try to achieve this effect…

I have the StackPanel at the top level set to fill the full screen. Within that, I have a collection of grids and each grid has two rows. The first row contains a button that spans the width of the screen with an expand/collapse icon on it and the second row contains a device browser.

I have triggers in place so that when one of the buttons is clicked, the visibility of the corresponding device browser is set to true and all others are set to false. Essentially this results in the appearance of an expand/collapse capability where only one section can be visible at a time.

When I publish this to a device, the page loads up with all of the sections “collapsed” but as soon as I click on one to expand it, the app crashes.

If the StackPanel cannot be used in this way, is there another approach I could take to implement something similar?

Here’s an example of what it looks like in the simulator with the first section expanded:

That should work. There’s nothing wrong with that approach I see. It’s most likely being triggered by a sizing calculation. For the time being, assign an absolute size to the DeviceBrowsers you are using. That control specifically is more likely to have issues when using it like this in a expand/collapse situation. So set the Width & Height on those controls to say 400 x 400 for example. Then when you want to expand/collapse, do so by changing the IsVisible property.

Can you be more specific when you say it crashes on every device? It’s probably a bug specific to the platform. Is it crashing on both Android & iOS?

You were right - placing a height onto the device browsers fixed the issue. Seems I’ll have to manually size for the typical usage, which will be portrait on a phone and will lose the dynamic sizing if rotated to landscape or used on a larger device like a tablet.

Any my apologies for the lack of clarity - when I said every device, I meant multiple different Android devices including phones and tablets. I haven’t tried this at all on an iPhone yet.