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
{{ message }}
This repository was archived by the owner on Nov 17, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: navigation.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,7 +125,7 @@ var navigationEntry = {
125
125
topmost.navigate(navigationEntry);
126
126
```
127
127
#Navigating to another page and passing context
128
-
Sometimes, the page being navigated to would have to receive information about the context in which this navigation happened. The bese example would be a master-details scenario where there are two pages -- the main page containing a list of some entities and a details page which provides details about a particular entity. In this case, when navigating to the details page it is mandatory to transfer some primary key or ID information about the entity the details page should show. This is done with the help of the **context** property of a NavigationEntry:
128
+
Sometimes, the page being navigated to would have to receive information about the context in which this navigation happened. The best example would be a master-details scenario where there are two pages -- the main page containing a list of some entities and a details page which provides details about a particular entity. In this case, when navigating to the details page it is mandatory to transfer some primary key or ID information about the entity the details page should show. This is done with the help of the **context** property of a NavigationEntry:
129
129
```JavaScript
130
130
functionlistViewItemTap(args) {
131
131
frames.topmost().navigate({
@@ -143,6 +143,21 @@ export function listViewItemTap(args: listView.ItemEventData) {
143
143
});
144
144
}
145
145
```
146
+
Once you pass this information, the best place to retrieve it and act accordingly is in the **onNavigatedTo** callback of the details page:
147
+
```JavaScript
148
+
functionpageNavigatedTo(args) {
149
+
var page =args.object;
150
+
page.bindingContext=page.navigationContext;
151
+
}
152
+
```
153
+
```TypeScript
154
+
// Event handler for Page "navigatedTo" event attached in details-page.xml
The topmost frame keeps track of the pages the user has visited in a navigation stack. To go back to a previous page you should use the **goBackMethod** of the topmost frame instance:
148
163
```JavaScript
@@ -152,5 +167,4 @@ topmost.goBack();
152
167
topmost.goBack();
153
168
```
154
169
#Alternatives
155
-
Alternatively, if you do not want to have different pages and navigate beteen them, you can have a single page with a TabView. You can define a different UI for each tab and when the user selects a certain tab he will be presented with this UI.
156
-
170
+
Alternatively, if you do not want to have different pages and navigate beteen them, you can have a single page with a TabView. You can define a different UI for each tab and when the user selects a certain tab he will be presented with this UI.
0 commit comments