How to Set Default Item in Power Apps Gallery?

Did you know how to set default item in Power Apps Gallery? In this Power Apps tutorial, I will explain how to set the Power Apps Gallery default selected item manually and many more like:

  1. Power Apps Gallery default selected item from the SharePoint list
  2. How to 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.

How to Set Default Item in Power Apps Gallery

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

  1. Power Apps Gallery sets the default selected item [Manually]
  2. Set the Power Apps gallery default selected item [Using SharePoint list]

Power Apps Gallery Set Default Selected Item Manually

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

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 using SharePoint list

Let us see how to use the SharePoint list to set the Power Apps gallery default selected item.

For example, I have a SharePoint Online 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 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 Power Apps gallery after form submit

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.

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

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

Example,

On my Power Apps screen, I have added two gallery controls, which both 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.

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

Conclusion

I hope this Power Apps tutorial gave you the complete information about the “Power Apps gallery default.

Lastly, I have explained Power Apps sets the default selected item in a gallery manually and many more:

  1. Power Apps Gallery default selected item from the SharePoint list
  2. After submitting the form, set the default selected item to the Power Apps gallery.
  3. How to set the Power Apps gallery default selected item based on another gallery.

Moreover, you may like some more Power Apps tutorials: