Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 66
Registered: ‎05-02-2013
My Device: Z10 LE, Q10, Passport
My Carrier: Fido
Accepted Solution

How to make a Container use remaining space in a StackLayout

My root container has a StackLayout with TopToBottom layout orientation. It contains two containers. The 2nd Container contains Button(s) so it's Height is adjusted automatically by Cascades. I want the first Container to occupy all remaining space of the device's display. What's the best way to accomplish this?

 

Thanks

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: How to make a Container use remaining space in a StackLayout

Hi,
Assign layoutProperties: StackLayoutProperties { spaceQuota: 1 }
to the first container.

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 66
Registered: ‎05-02-2013
My Device: Z10 LE, Q10, Passport
My Carrier: Fido

Re: How to make a Container use remaining space in a StackLayout

Thank you! That works. I tried using spaceQuota but I was assigning it to both containers. The trick is to just set it on the first Container as you suggested. My initial attempt was to set verticalAlignment to Fill but that did nothing.

 

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: How to make a Container use remaining space in a StackLayout

verticalAlignment only works on horizontal StackLayout.

horizontalAlignment - on vertical StackLayout. Smiley Happy

Another option is using "preferredWidth/preferredHeight: Infinity" (this is needed in ListView-s where "alignment: Fill" method doesn't work).

Andrey Fidrya, @zmeyc on twitter