Hi, I am looking for help using the third overload for the NavigationService.Configure method:
NavigationService.Configure(string key, Func<object, UIViewController> createAction)
Have you ever used it? If anyone can provide an example that would be great.
Thank you,
mike
@Michael_Shapiro :
This is how we are using it in our project and this has helped us to solve the problem of navigation between storyboards as well.
So in AppDelegate.cs file, use below to configure view controller to key
nav.Configure("Key", (arg) => {
var storyboard = UIStoryboard.FromName("YourStoryboardName", null);
return storyboard.InstantiateViewController("YourViewControllerName")
as YourViewController;
});
This overload of navigation configure allows us to control the view controller creation.
Hope this helps
Answers
@Michael_Shapiro :
This is how we are using it in our project and this has helped us to solve the problem of navigation between storyboards as well.
So in AppDelegate.cs file, use below to configure view controller to key
nav.Configure("Key", (arg) => {
var storyboard = UIStoryboard.FromName("YourStoryboardName", null);
return storyboard.InstantiateViewController("YourViewControllerName")
as YourViewController;
});
This overload of navigation configure allows us to control the view controller creation.
Hope this helps
@KratiChauhan - thank you very much! I actually did a lot of testing and came up with the same use case for this overload. I am truly glad you provided your use of it as well.
The funny part is that I was not looking at this third overload to solve the navigation between different story boards:) I initially was trying to find a way to control how a view is being shown when user navigate from view to view. I use the mvvm light's NavigateTo method in my ViewModel layer. I am on screenA and when some condition is met my viewmodel for this screen calls NavigateTo(screenB). It all works fine, and the screenB shows up in a a regular way by appearing/sliding from right edge towards the left edge. I was looking for a way to somehow control how the destination screen is appearing when calling the NavigateTo method. Unfortunately I could not find anything that would help aside of changing the source code of the mvvm light