cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Can you highlight the selected record in a Gallery

It would be really useful (especially in tablet pages) to be able to highligt the selected record in a Gallery control. Is this possible?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Can you highlight the selected record in a Gallery

Galleries have two fill properties: Fill and TemplateFill. Fill is the background of the Gallery. TemplateFill can color individual records. In your case, you will need to edit the TemplateFill

 

For Gallery1.TemplateFill:

If(Title=Gallery1.Selected.Title,
RGBA(color that you want selected), 
RGBA(regular color)
)

Change Title to whatever column of yours has unique values. 

Microsoft Employee
@8bitclassroom

View solution in original post

17 REPLIES 17
Community Champion
Community Champion

Re: Can you highlight the selected record in a Gallery

Hi:

 

Yes, it is possible.

I have shared before and wish to share here again.

 

How to set color by for EVEN and ODD Rows?
(This is what normally we can get easily when making Excel Table)

1. In Excel Table, Include ID in the first column. (for CDM/CDS< you may refer to Title, or any other sequence no.)

In the case of Excel: see 2, 3, 4

2. When Adding Record from Screen 1 and Navigate to Screen 1
Set OnSelect To: Navigate(……………, {Record: Defaults(TableX)})

3. When saving on Screen 2, set
OnSelect: UpdateContext({Record: Patch(TableX, Record, {ID: If(!IsBlank(Record.ID), Record.ID, Text(Max(TableX, ID) + 1)),……..}

4. When navigate back to Screen 1 with Gallery, set the
Gallery Template, Inserted Shape, or Any TextBox or Shape, to set the FILL or Color with:
If(Right(Text(Value(ThisItem.ID)/2, "#.#"), 1) = "5", Color!AliceBlue, Color!Aqua))
Or
If(Mod(Value(ThisItem.ID), 2) = 0, Color!AliceBlue, Color!Aqua))


With this, you can have the Alternate Color as of Excel Table.

NB: It was told that this is not supported in Project Siena and PowerApps, but with ID number created automatically (as of No. 3), this can be accomplished.
In fact, under C# (if not mistaken), it can be done with:
WHERE CAST (Left(Right(IDNUMBER, 2),1) As Int) % 2 = 0 (As provided by friend, easily)

 

Hope this helps.

hpkeong
Highlighted
Advocate I
Advocate I

Re: Can you highlight the selected record in a Gallery

I don't think this is the same - I am talking about having a Gallery on the left hand side of a tablet screen with details to the right. I would like to highlight the selected row in the gallery (mainly for aesthetic reasons).

Highlighted
Community Champion
Community Champion

Re: Can you highlight the selected record in a Gallery

Hi

 

Yes, it is possible. Tricks using If as well and OnSelect.

Currently no example to share (as my system is slow here).

THanks.

hpkeong
Highlighted
Community Champion
Community Champion

Re: Can you highlight the selected record in a Gallery

Hi

 

Spare some free time on Sunday to create a sample and hope it works.

 

Please remember to add an, e,g,:

- Button inside the gallery (to replace the normal Arrow Icon, where the Button fill up the whole gallery row).

- Delete the text "Button"

- Then Button.Fill = If(ThisItem.IsSelected, ColorA, ColorB)

- Make sure the transparency of the color, RGBA( x1, x2, x3, Transprency value) is set to what you wish to ahve.

 

 

 

 Screenshot (40).pngScreenshot (41).png

hpkeong
Highlighted
Community Champion
Community Champion

Re: Can you highlight the selected record in a Gallery

Galleries have two fill properties: Fill and TemplateFill. Fill is the background of the Gallery. TemplateFill can color individual records. In your case, you will need to edit the TemplateFill

 

For Gallery1.TemplateFill:

If(Title=Gallery1.Selected.Title,
RGBA(color that you want selected), 
RGBA(regular color)
)

Change Title to whatever column of yours has unique values. 

Microsoft Employee
@8bitclassroom

View solution in original post

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Can you highlight the selected record in a Gallery

Thanks @mr-dang just what I was looking for.

Highlighted
Frequent Visitor

Re: Can you highlight the selected record in a Gallery

"Title" is a little misleading. i was using the title tag at first. But you did clarify use a unique column.

Highlighted
Power Apps
Power Apps

Re: Can you highlight the selected record in a Gallery

You can also use the ThisItem.IsSelected property, so you don't need to know about unique values in the data source:

If(
    ThisItem.IsSelected,
    RGBA(color that you want selected),
    RGBA(regular color)
)
Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Can you highlight the selected record in a Gallery

Just to clarify, put the following code in the TemplateFill Property of the gallery control

 

      If( ThisItem.IsSelected, RGBA(196, 196, 196, 50%), RGBA(0, 0, 0, 0))

 

This examples fills with gray... 

 

Works great but I have not yet figured out how to select multiple items ( tried holding Shift key and ctrl key - no go ) Seems like you can only select 1 item at at time... maybe you will find a trick to select many items to highlight many rows in a gallery?

 

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,000)