cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SukhRehal
Regular Visitor

Change size of Gallery

Hi All,

 

I am trying to dynamically change the size of a gallery I have in my canvas app.

The gallery is based on a collection, typically the collection will consist of 3 or 4 items in it but can be more or less.

What I am trying to achieve is to change the size of the actually gallery itself depending on the number of items in the collection.

 

so if the collection has 1 record in it then the gallery height will only show the one item, if it has 4 then the gallery will have 4 items on display and then shrink to fit if I delete an item.

 

Apologies if this has been asked already, I did search but couldn't see a similar question/answer.

 

Thank You,

 

- Sukh

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@SukhRehal 

Change your Height property of your Gallery to:

  (Self.TemplateHeight + Self.TemplatePadding) * CountRows(Self.AllItems)

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
zmansuri
Super User
Super User

Go to Template Size property of your gallery: let's say template size is 110.

Now go to height property of the gallery. Write:

110 * CountRows(Collection).

That way if your collection have 3 records. Your gallery's height will be

110 * 3 = 330.

RandyHayes
Super User
Super User

@SukhRehal 

Change your Height property of your Gallery to:

  (Self.TemplateHeight + Self.TemplatePadding) * CountRows(Self.AllItems)

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

SukhRehal
Regular Visitor

Thank you guys for the quick response.

 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,435)