cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
karimabdelrazek
Resolver I
Resolver I

Dynamic Y based on selection in a gallery?

Hi,

I have two galleries. Gallery 1 contains a list of 5 items. Gallery 2 contains the details of each item from Gallery 1.

I would like to position the location of Gallery 2 right next to the selected item from Gallery 1 (i.e. dynamic Y based on the selected item from Gallery 1).

Doable?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @karimabdelrazek ,

I have just tested it and this works (except as I mentioned, it can go off the screen if your numbers are big enough)

Gallery1.Selected.RowNo * Gallery1.TemplateHeight + Gallery1.Y

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @karimabdelrazek ,

Firstly, the Selected Item of a gallery does not have a Y Property.

Depending on the possibility if this going off the screen, it would be (sort of) achievable by collecting the first list

ClearCollect(colFirstList, FirstList)

Adding a number column to it

Clear(colYRef);
ForAll(
   colFirstList,
   Collect(
      colYRef,
      Last(
         FirstN(
            AddColumns(
               colFirstList,
               "RowNo",
               CountRows(colYRef) + 1
            ),
            CountRows(colYRef) + 1
         )
      )
   )
)

Then setting base the First list on colY and the Y of the second list to something like

(colY.Selected.RowNo * Gallery2.TempleSize) + Gallery2.Y

I have not tested any of this - it is a concept.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz . Thank you for the concept! I'll try it out and let you know if I got it to work or not.

Hi @karimabdelrazek ,

I have just tested it and this works (except as I mentioned, it can go off the screen if your numbers are big enough)

Gallery1.Selected.RowNo * Gallery1.TemplateHeight + Gallery1.Y

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks so much Warren! You beat me to it! 🙂

Hi @karimabdelrazek ,

A bit of fine-tuning - I am actually going to use this myself. This will line the second gallery up exactly with the top of the selected item on the first on every selected item.

Gallery1.Selected.RowNo * 
(Gallery1.TemplateHeight + Gallery1.TemplatePadding) + 
Gallery1.Y - Gallery1.TemplateHeight

 

FloatingGallery.gif

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (290)