cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stapes
Post Prodigy
Post Prodigy

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 III
Super User III

@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 III
Super User III

@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

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
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (30,727)