You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/maker/canvas-apps/functions/function-navigate.md
+53-15Lines changed: 53 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -7,28 +7,29 @@ ms.service: powerapps
7
7
ms.topic: reference
8
8
ms.custom: canvas
9
9
ms.reviewer: anneta
10
-
ms.date: 04/23/2019
10
+
ms.date: 05/16/2019
11
11
ms.author: gregli
12
12
search.audienceType:
13
13
- maker
14
14
search.app:
15
15
- PowerApps
16
16
---
17
17
# Back and Navigate functions in PowerApps
18
+
18
19
Changes which screen is displayed.
19
20
20
21
## Overview
22
+
21
23
Most apps contain multiple screens. Use the **Back** and **Navigate** function to change which screen is displayed. For example, set the **[OnSelect](../controls/properties-core.md)** property of a button to a formula that includes a **Navigate** function if you want to show a different screen when a user selects that button. In that formula, you can specify a visual transition, such as **Fade**, to control how one screen changes to another.
22
24
23
-
**Back** and **Navigate** change only which screen is displayed. Screens that aren't currently displayed continue to operate behind the scenes. You can build formulas that refer to properties of controls on another screen. For example, a user can change the value of a slider on one screen, navigate to a different screen that uses that value in a formula, and see how it affects what happens in the new screen. The user can then navigate back to the original screen and see that the slider has retained its value.
25
+
**Back** and **Navigate** change only which screen is displayed. Screens that aren't currently displayed continue to operate behind the scenes. You can build formulas that refer to properties of controls on other screens. For example, a user can change the value of a slider on one screen, navigate to a different screen that uses that value in a formula, and ascertain how it affects what happens in the new screen. The user can then navigate back to the original screen and confirm that the slider has retained its value.
24
26
25
27
[Context variables](../working-with-variables.md#use-a-context-variable) are also preserved when a user navigates between screens. You can use **Navigate** to set one or more context variables for the screen that the formula will display, which is the only way to set a context variable from outside the screen. You can use this approach to pass parameters to a screen. If you've used another programming tool, this approach is similar to passing parameters to procedures.
26
28
27
-
## Description
28
-
### Back
29
-
The **Back** function displays the screen that was most recently displayed. You don't specify any arguments for this function.
29
+
You can use either function only within a [behavior formula](../working-with-formulas-in-depth.md).
30
+
31
+
## Navigate
30
32
31
-
### Navigate
32
33
In the first argument, specify the name of the screen to display.
33
34
34
35
In the second argument, specify how the old screen changes to the new screen:
@@ -46,12 +47,23 @@ You can use **Navigate** to create or update context variables of the new screen
46
47
47
48
Set the **[OnHidden](../controls/control-screen.md)** property of the old screen, the **[OnVisible](../controls/control-screen.md)** property of the new screen, or both to make additional changes during the transition. The **App.ActiveScreen** property will be updated to reflect the change.
48
49
49
-
**Back** normally returns **true** but returns **false** if the user is on the first screen shown and there is no previous screen. **Navigate** normally returns **true** but returns **false** if there is a problem with one of its arguments.
50
+
**Navigate** normally returns **true** but will return **false** if an error is encountered.
51
+
52
+
## Back
53
+
54
+
The **Back** function returns to the screen that was most recently displayed.
55
+
56
+
For each **Navigate** call, the app tracks the screen that appeared and the transition. You can use successive **Back** calls to return all the way to the screen that appeared when the user started the app.
50
57
51
-
You can use these functions only within a [behavior formula](../working-with-formulas-in-depth.md).
58
+
When the **Back** function runs, the inverse transition is used by default. For example, if a screen appeared through the **CoverRight** transition, **Back** uses **UnCover** (which is to the left) to return. **Fade** and **None** are their own inverses. Pass an optional argument to **Back** to force a specific transition.
59
+
60
+
**Back** normally returns **true** but returns **false** if the user hasn't navigated to another screen since starting the app.
52
61
53
62
## Syntax
54
-
**Back**()
63
+
64
+
**Back**( [*Transition*] )
65
+
66
+
**Transition* - Optional. The visual transition to use between the current screen and the previous screen. Refer to the list of valid values for this argument earlier in this topic. By default, the transition through which a screen returns is the inverse of the transition through which it appeared.
@@ -67,13 +79,39 @@ You can use these functions only within a [behavior formula](../working-with-for
67
79
|**Navigate( Details, ScreenTransition.Fade )**|Displays the **Details** screen with a **Fade** transition. No value of a context variable is changed. |The current screen fades away to show the **Details** screen. |
68
80
|**Navigate( Details, ScreenTransition.Fade, { ID: 12 } )**|Displays the **Details** screen with a **Fade** transition, and updates the value of the **ID** context variable to **12**. |The current screen fades away to show the **Details** screen, and the context variable **ID** on that screen is set to **12**. |
69
81
|**Navigate( Details, ScreenTransition.Fade, { ID: 12 , Shade: Color.Red } )**|Displays the **Details** screen with a **Fade** transition. Updates the value of the **ID** context variable to **12**, and updates the value of the **Shade** context variable to **Color.Red**. |The current screen fades away to show the **Details** screen. The context variable **ID** on the **Details** screen is set to **12**, and the context variable **Shade** is set to **Color.Red**. If you set the **Fill** property of a control on the **Details** screen to **Shade**, that control would display as red. |
82
+
|**Back()**| Displays the previous screen with the default return transition. | Displays the previous screen through the inverse transition of the transition through which the current screen appeared. |
83
+
|**Back( ScreenTransition.Cover )**| Displays the previous screen with the **Cover** transition. | Displays the previous screen through the **Cover** transition, regardless of the transition through which the current screen appeared. |
70
84
71
85
### Step-by-step
72
-
1. Name the default screen **DefaultScreen**, add a label to it, and set the **[Text](../controls/properties-core.md)** property of that label so that it shows **Default**.
73
-
2. Add a screen, and name it **AddlScreen**.
74
-
3. Add a label to **AddlScreen**, and set the **[Text](../controls/properties-core.md)** property of the label so that it shows **Addl**.
75
-
4. Add a button to **AddlScreen**, and set its **[OnSelect](../controls/properties-core.md)** property to this function:<br>**Navigate(DefaultScreen, ScreenTransition.Fade)**
76
-
5. From the **AddlScreen**, press F5, and then select the button.<br>**DefaultScreen** appears through a fade transition.
0 commit comments