How to Set Default Item in Power Apps Gallery?

Recently, I was working on a Power Apps gallery where I needed to set a default value from a SharePoint list. To achieve this, we can use the Power Apps Default property that helps to set the default value of any control.

In this Power Apps article, I will explain how to set default item in Power Apps gallery manually and many more like:

  1. Set default item in Power Apps gallery from a SharePoint list
  2. Set the default selected item to the Power Apps gallery after submitting the form
  3. Set the Power Apps gallery default selected item based on another gallery

Set Default Item in Power Apps Gallery

This section will describe how to set the default item in a Power Apps gallery using two ways:

  1. Set Power Apps gallery default item manually
  2. Set Power Apps gallery default item from a SharePoint list

Power Apps Gallery Set Default Selected Item Manually

I will show you how to set the Power Apps Gallery default selected item manually.

Example:

I have created a Power Apps Canvas app and then added a Gallery Control.

The gallery contains the “Product Details” [Which I added manually]. Next, whenever the user opens or loads an app, the Power Apps gallery will automatically select its default value, as shown below:

Power Apps set gallery default selected item manually

Let me show you how to achieve this:

1. On the Power Apps screen, insert a Gallery control -> Set its Items property to:

[
    "Laptop",
     "Xbox Series S 1-TB",
     "Mouse",
     "Smart Phone",
     "Head Phone",
]
Default selected item of a Power Apps gallery

2. Select the Gallery control -> Set its Default property to:

{Value:"Xbox Series S 1-TB"}
Gallery default selected item in Power Apps

3. To highlight the default selected value in the gallery control -> Set its TemplateFill property as:

If(
    ThisItem.IsSelected,
    Color.GoldenRod,
    Color.WhiteSmoke
)
How to set default item in Power Apps gallery

4. Save, Publish, and close the app. Then, reopen and preview the app. The Power Apps gallery item will be selected as “Xbox Series S 1-TB” by default.

How to Set Default Item in Power Apps Gallery

This is how I manually set the Power Apps Gallery default selected item.

Set Power Apps gallery default selected item from SharePoint list

Let us see how to set a Power Apps gallery default selected item from a SharePoint list.

For example, I have a SharePoint list [Employee Details] that has various columns like:

Column NameData Type
Employee IDTitle
Employee NameSingle line of text
Employee DepartmentChoice [HR, Marketing, Finance, IT]
Employee Joining DateDate and time
Power Apps gallery default selected item

I created a Power Apps canvas app and then added a Gallery control connected to the above SharePoint list.

Whenever the user opens or loads an app, the Power Apps gallery control will automatically select its default value from the above list choice column value of “Marketing,” as shown below:

Power Apps Gallery Default

Let me show you how to achieve this:

1. Create a Power Apps Blank canvas app -> Connect to the SharePoint Online list -> as in the screenshot below:

Set Power Apps gallery default selected item using SharePoint list

2. On the Power Apps screen, insert a Gallery control -> Set its Items property to:

'Employee Details'

Where,

  • Employee Details = SharePoint list name
Set Power Apps gallery default selected item

3. Select the Gallery control -> Set its Default property to:

LookUp(
    'Employee Details',
    'Employee Department'.Value = "Marketing"
)

Where,

  • Employee Details = SharePoint list name
  • Employee Department = SharePoint list choice column name
  • Marketing = SharePoint list choice column value
How to set Power Apps gallery default selected item using SharePoint list

4. To highlight the default selected value in the gallery control -> Set its TemplateFill property as:

If(
    ThisItem.IsSelected,
    RGBA(
        187,
        221,
        140,
        1
    ),
    Color.WhiteSmoke
)
Set default selected item for a Power Apps gallery

5. Save, Publish, and close the app. Then, reopen and preview the app. The gallery control will automatically select its default value from the above list choice column value of “Marketing.”

Set default selected item for a Power Apps gallery using SharePoint list

I achieved this by setting a default selected item for a Power Apps gallery control.

Set the default selected item to the Power Apps gallery after submitting the form

In this section, I will explain how to set a Power Apps default selected item to the gallery after submitting the form.

Example:

I created a Power Apps canvas app and then added an Edit form and a Gallery control, both are connected to the above SharePoint list.

Whenever the user provides the details in the form and clicks the Submit Button control, the provided details will be displayed in the gallery control. That particular item will be selected as default, as shown below:

Power Apps sets the default selected item to the gallery after the form submit

Follow the below steps to achieve this:

1. On the Power Apps screen, insert an Edit form. Then, add a new data source for the above SharePoint list and set the Edit form’s Data source property:

'Employee Details'

Where,

  • Employee Details = SharePoint list name
Set default selected item to the Power Apps gallery after submitting the form

2. Insert a Button control -> Set its OnSelect property to:

SubmitForm(Form1);NewForm(Form1);
Default selected item of a Power Apps gallery after save

3. Insert a Gallery control -> Set its Items property to:

Employee Details

Where,

  • Employee Details = SharePoint list name
How to set default item to Power Apps gallery

4. Select the Gallery control -> Set its Default property to:

First(
    Sort(
        'Employee Details',
        Created,
        SortOrder.Descending
    )
)
Setting the default value in a Power Apps gallery

5. To highlight the default selected value in the gallery control -> Set its TemplateFill property as:

If(
    ThisItem.IsSelected,
    Color.Gold,
    Color.WhiteSmoke
)
Setting the Power Apps gallery default value

6. Save, Publish, and close the app. Then, reopen and preview the app. When the user provides the details in the form and clicks the Submit button, the provided details will be displayed in the gallery control. That particular item will be selected as default.

Set default selected item to the gallery after the form submit in Power Apps

After submitting the form, I achieved this by setting a Power Apps default selected item to the gallery.

Set default item in the Power Apps Gallery based on another gallery

Here, I will explain how to set the Power Apps gallery default selected item based on another gallery.

Example:

I have added two gallery controls to my Power Apps screen, both of which are connected to the above SharePoint list.

Whenever the user selects a particular item from the 1st gallery, then by default, the 2nd gallery item will be selected based on it as shown below:

Power Apps set the default selected item in a gallery based on another gallery

Follow the below steps to achieve this:

1. On the Power Apps screen, insert a first Gallery control -> Set its Items property to:

'Employee Details'

Where,

  • Employee Details = SharePoint list name
Set Power Apps default selected item in a gallery based on another gallery

2. Insert a second Gallery control -> Set its Items property to:

'Employee Details'
How to set Power Apps default selected item in a gallery based on another gallery

3. Select the second gallery control -> Set its Default property to:

LookUp(
    'Employee Details',
    ThisRecord.Title = Gallery1.Selected.Title
)
Power Apps set gallery default items based on another gallery

4. To highlight the default selected value in the gallery control -> Set its TemplateFill property as:

If(
    ThisItem.IsSelected,
    Color.Bisque,
    Color.WhiteSmoke
)
Set default gallery item in Power Apps

5. Save, Publish, and close the app. Then, reopen and preview the apps. Whenever the user selects a particular item from the 1st gallery, then by default, the 2nd gallery item will be selected based on it.

Power Apps set the default selected item in a gallery based on another gallery

This is how to set the Power Apps gallery default selected item based on another gallery.

Conclusion

I hope this article helped you learn how to set the default item in a Power Apps gallery manually and from a SharePoint list.

Additionally, we discussed how to set the Power Apps gallery default item after submitting the form and set the Power Apps gallery default item based on another gallery with various examples.

Moreover, you may like some more Power Apps tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…