Lab - Create navigation functions
Read this first - before you start the lab!
For this lab, do not sign in with your credentials. Use the following steps to sign in to your lab environment with the correct credentials.
- Select Launch VM mode in this unit.
- You'll see a PowerShell window and a Windows Command window appear. After about two to three minutes, they'll close, and Power Apps will open automatically. Wait for the Power Apps home screen.
- To see the lab instructions, select the Instructions tab on the lab side bar.
You can now begin your work on this lab.
The purpose of this tutorial is to provide a more detailed example of using the Back and Navigate functions with multiple controls in a common real-world scenario. In many of the apps that you develop, certain screens may have multiple controls allowing users to navigate to different screens depending on the control they select. In the following example, you create a three screen app to demonstrate the Navigate and Back functionality.
Go to the Power Apps Studio.
Select the Create tab from the left-side navigation rail.
Select Blank app, and in the Create popup pane select Create under the Blank canvas app option.
A window called Canvas app from blank opens in your browser. Enter a name for your app, ensure that you have Tablet layout selected as the format (default setting). Then select Create.
In the new blank app, you can Skip the "Welcome to Power Apps Studio" popup. Then select the New screen button from the top ribbon, and choose Blank.
This creates a new blank screen in your app. Repeat once more to have three screens total.
On Screen1, insert a Button control and change the Text property to "Next".
Likewise, go to Screen2, add a Button control and change the Text to "Next".
Add a second Button to Screen2 and change the Text to "Back".
Now go to Screen3, add a Button control and change the Text property to "Back".
Return to Screen1, select the "Next" button and set the OnSelect property to:
Once you enter this logic, Power Apps abbreviates this property to Navigate(Screen2,Fade), but when you select the formula in the Power fx formula bar, it returns to the unabbreviated formula.
Go to Screen2. Select the Next button and set the OnSelect property to:
Select the Back button. Set the OnSelect property to
Go to Screen3. Select the Back button and set the OnSelect property to
Next, we test your button functionality.
Return to Screen1, and put the app in Preview or Play mode and navigate through the app as a user would. As you select each button, notice the subtle visual transitions of each screen transition. Notice how when you select your Back buttons, the transitions go in reverse order.
Now, let's try some of the other transitions. Put the app back into Edit mode and return to Screen1.
Select the Next button and change the OnSelect property to:
Go to Screen2. Select your Next button and change the OnSelect property to:
Now, return to Screen1, put the app back into Preview/Play mode, and observe the behavior of these transitions.
Finally, let's try adding in a screen transition for a Back button. Like the Navigate function, a screen transition is optional for the Back() function, too. Go to Screen2 and select your Back button. Modify the OnSelect property to the following:
Return to Screen1. Put the app in Preview/Play mode, select Next to go to Screen2, and then select the Back button. Did you notice that the transition between screens was different? When you select the Back button from Screen2 to return to Screen1 your buttons seemed to move quickly from left to right off of the screen.
Hopefully, you've been able to see the differences in the transitions available for screen navigation. It's up to you how you employ them in your solutions.
Remember, the Navigate and Back functions can include screen transitions, but they aren't required.
If you are following a learning path, keep this lab open for use as you continue learning.