cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JulianKirkness
Level: Powered On

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
mr-dang
Level 10

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

13 REPLIES 13
hpkeong
Level 10

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
JulianKirkness
Level: Powered On

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).

hpkeong
Level 10

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
hpkeong
Level 10

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
mr-dang
Level 10

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

UB400
Level 10

Re: Can you highlight the selected record in a Gallery

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

amarion
Level: Powered On

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.

PowerApps Staff CarlosFigueira
PowerApps Staff

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)
)
skylitedave
Level 10

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,819)