cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stapes
Impactful Individual
Impactful Individual

How can I set the Select value of a Gallery to the Nth item?

I want to set a default item from a Gallery as Selected when the screen loads, but not to activate the OnSelect. Is this what the Default Property of a Gallery is for?

How could I make it treat i.e: Row 2 as the Selected row?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@stapes 

Yes, that's exactly what Default is for.  I believe you could select row 2 by using this code in the Default property.

 

LastN(FirstN(Gallery1.AllItems,2),1)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

2 REPLIES 2
mdevaney
Super User
Super User

@stapes 

Yes, that's exactly what Default is for.  I believe you could select row 2 by using this code in the Default property.

 

LastN(FirstN(Gallery1.AllItems,2),1)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

To add to that, if you want to make it apparent to the user which gallery item is selected by default, you can set the TemplateFill property of the gallery to:
If(ThisItem.IsSelected, Blue, White)

Blue and White are just for examples. Replace them with the fill colors you want.

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,598)