Contents

Spice up Your Navigation with Modern TabList Control

 

Another post about how to improve the looks of any given app! We’re used to have buttons for the navigation, this is the classic way of doing things and it works very well of course.

But when Microsoft released new modern controls, the TabList control is pretty awesome to create our navigation 😁  

Connect the TabList control

When you add the TabList control, you can connect to a data source, or you can insert the values directly into the Items property of that control.

/images/powerplatform-screenshots/TabList-PowerApps-img1.png
 

In our case, we’re going to make use of the (Named) Formulas property of the App.
 

Named Formulas? What’s that?

Back in 2022, Microsoft introduced Power Fx: Named Formulas. In a nutshell, this concept (taken from Excel!) allows for better performance of the app. The formulas are only called when needed, with no dependencies on the App.OnStart property.
 

Benefits & Good To Know
There are more benefits and behaviors to know about, so make sure to read the link above if you’re not using Named Formulas yet.
 

Create navigation menu items

Into the app, let’s go into the Formulas property, and start creating our menu. Each item will allow us to navigate to the different screens.

 

Enter the following formula:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
MenuItems = [
    {
        MenuTitle: "Home",
        GoToScreen: 'Home Screen'
    },
    {
        MenuTitle: "Approvals",
        GoToScreen: 'Approval Screen'
    },
    {
        MenuTitle: "Support",
        GoToScreen: 'Support Screen'
    }
];

 

You’ll note that the MenuTitle value is different from the GoToScreen value. This let’s you name your navigation items what you want, compared to the screen names in PowerApps.  

/images/powerplatform-screenshots/TabList-PowerApps-img2.png
 

semi-colon
A semi-colon is mandatory at the end of each statement, even if there’s nothing else after.
 

Display the correct menu items values

Go to your TabList control on Screen1, and in the Items property, add MenuItems. And at this point, you probably see numbers?? 🤔

Let’s fix that. On the right Properties panel/blade:

  • Click on Edit next to Fields
  • Then Add field
  • Select MenuTitle
  • Then click Add.
  • Repeat for each TabList control if necessary (in case you had created the screens before)

/images/powerplatform-screenshots/TabList-PowerApps-img3.png

You now have the proper values displayed!

 

Let’s make it all work!

But right now, we can click on the navigation and it does… NOTHING!

We need to hook up everything up still.

  • Click on the TabList control
  • Go to the OnSelect property
  • Enter the following formula » Navigate(Self.Selected.GoToScreen)
  • In DefaultSelectedItems » LookUp(MenuItems, GoToScreen=App.ActiveScreen)
  • Repeat for each TabList control if necessary (in case you had created the screens before)

/images/powerplatform-screenshots/TabList-PowerApps-img4.png
 

Et voila!

/images/powerplatform-screenshots/TabList-PowerApps-img5.gif
 

Thanks for reading! 🙂