-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Update existing reference navigation docs
- Loading branch information
1 parent
9383e7e
commit c017bc3
Showing
8 changed files
with
89 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
uid: Reference.Navigation.RequestHandler | ||
--- | ||
|
||
# Building a Custom Request Handler | ||
|
||
- Show how to create a custom NavigationRequestHandler that will intercept event on a control in order to trigger navigation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
--- | ||
uid: Reference.Navigation.RouteMap | ||
--- | ||
|
||
# What is a RouteMap | ||
|
||
## RouteMap | ||
|
||
In order for navigation to support both view and viewmodel based navigation it is necessary to have some way to define a mapping, or association, between a view and viewmodel (for example MainPage is mapped to MainViewModel, and vice versa). However, given the different intents and behaviours we needed to support, navigation supports a more complex mapping that is referred to as a RouteMap. | ||
To support navigation with both View and ViewModel, we need a way to define a mapping between them (e.g., MainPage maps to MainViewModel). However, because of the various intents and behaviors we must support, our navigation system uses a more complex mapping called a RouteMap. | ||
|
||
A RouteMap is made up of the following components: | ||
|
||
| Component | Description | | ||
|------------|----------------------------------------------------------------------------------------------------------------------------------| | ||
| Path | The name of the route. When processing a NavigationRequest the Base is used to look up the RouteMap with the corresponding Path.<br>This is used to match to the Region.Name attribute for PanelVisibilityNavigator, NavigationViewNavigator and TabBarNavigator<br>NavigateRouteAsync(sender, Path) to navigate to the RouteMap with matching Path.<br>That Path is also used to populate the deep link at any point in the application. | | ||
| View | The type of view to be created (or in the case of Frame, navigated to)<br>NavigateViewAsync<Tview>(sender) to navigate to the RouteMap with the matching View (type) | | ||
| ViewModel | The type of view model to be created, and set as DataContext for the current view of the region<br>NavigateViewModelAsync<TViewModel>(sender) to navigate to the RouteMap with the matching ViewModel (type) | | ||
| Data | The type of data being sent in the navigation request<br>NavigateDataAsync(sender, Data: data) to navigate to the RouteMap with matching Data (type) | | ||
| ResultData | The type of data to be returned in the response to the navigation request<br>NavigateForResultAsync<TResultData>(sender) to navigate to the RouteMap with matching ResultData(type) | | ||
| Path | The name of the route. When processing a NavigationRequest the Base is used to look up the RouteMap with the corresponding Path.<br>This is used to match to the Region.Name attribute for `PanelVisibilityNavigator`, `NavigationViewNavigator` and `TabBarNavigator`<br>`NavigateRouteAsync(sender, Path)` to navigate to the RouteMap with matching Path.<br>That Path is also used to populate the deep link at any point in the application. | | ||
| View | The type of view to be created (or in the case of `Frame`, navigated to)<br>`NavigateViewAsync<TView>(sender)` to navigate to the RouteMap with the matching View (type) | | ||
| IsDefault | Determines which child route should, if any, be used as the default route | | ||
| DependsOn | Enables establishing a dependency between two views. This argument expects a route name and ensures that when navigating to a view with dependencies, the dependent view will be navigated to first before opening the requested view | ||
| Init | Callback function to be invoked prior to navigation for a particular route | | ||
| ToQuery | Callback function to convert a data object into query parameters (eg Product -> [{"ProductId", "1234"}] ) | | ||
| FromQuery | Callback function to convert query parameters into a data object (eg [{"ProductId", "1234"}] -> Product ) | | ||
| Nested | Child routes - currently only used to specify default views for nested regions | | ||
|
||
- Explain what a RouteMap is and how it's used to define the route hierarchy in the app | ||
| Nested | Child routes - currently only used to specify default views for nested regions | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
--- | ||
uid: Reference.Navigation.ViewMap | ||
--- | ||
|
||
# What is a ViewMap | ||
|
||
- Define what a viewmap is and the relationship between view, viewmodel and datamap | ||
When registering routes, we can take advantage of the `ViewMap` object and its variations `DataViewMap` and `ResultDataViewMap`, to associate Views with ViewModels, specify the type of parameters ViewModels may take, and specify the type of return coming from a navigation. | ||
|
||
## ViewMap | ||
|
||
| Component | Description | Example | | ||
|----------------|----------------------|---------| | ||
| View | The type of the View | `new ViewMap(typeof(MainPage))`<br><br>Alternatively can be specified as a generic argument: `new ViewMap<MainPage>()` | | ||
| ViewSelector | ? | ? | | ||
| ViewModel | The type of the ViewModel being associated with the View | `new ViewMap(typeof(MainPage), ViewModel: typeof(MainViewModel))`<br><br>Alternatively can be specified as a generic argument: `new ViewMap<MainPage, MainViewModel>()` | | ||
| Data | A `DataMap<T>` to be injected into the ViewModel during navigation<br><br>Alternatively `DataViewMap` can be used | `new ViewMap<MainPage, MainViewModel>(Data: new DataMap<MyObject>)`<br><br>`new DataViewMap<MainPage, MainViewModel, MyObject>()` | | ||
| ResultData | Define an association between the view and the type of data being requested<br><br>Alternatively `ResultDataViewMap` can be used | `new ViewMap<MainPage, MainViewModel>(ResultData: typeof(MyObject))`<br><br>`new ResultDataViewMap<MainPage, MainViewModel, MyObject>()` | | ||
| ViewAttributes | ? | ? | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters