Comments (10)
Here's what you might be trying to do.... basically you can get the HomePageModel instance, and pass it into the MenuPageModel, from that instance you can call CoreMethod.PushPageModel.
var homePage = FreshPageModelResolver.ResolvePageModel<HomePageModel>();
this.Detail = new FreshNavigationContainer(homePage);
var homePageModel = homePage.GetModel();
var menuPage = FreshPageModelResolver.ResolvePageModel<MenuPageModel>(homePageModel);
this.Master = menuPage;
homePageModel.CoreMethods.PopToRoot();
homePageModel.CoreMethods.PushPageModel<SecondLevelPage>();
from freshmvvm.
Thank you @rid00z for your great work.
I use the code you mentioned earlier and it works fine but a problem is master page still showing after clicking on a button that shows another page on detail section.
how can i hide master menu?
from freshmvvm.
FreshMvvm has a built in master detail Navigation, you can use that or take
the code from that and modify.
Thanks
On Tuesday, 29 March 2016, fcogutierrez [email protected] wrote:
Hello,
I have a MenuPage (and MenuPageModel) as Master page. This menu has a list
of options with some commands binded.How can I do for do the navigation (PushAsync) from MenuPageModel? Here is
my code.var menuPage = FreshPageModelResolver.ResolvePageModel<MenuPageModel>(); this.Master = menuPage; var homePage = FreshPageModelResolver.ResolvePageModel<HomePageModel>(); this.Detail = new FreshNavigationContainer(homePage);
Thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#57
Michael Ridland | Technical Director | Xamarin MVP
XAM Consulting - Mobile Technology Specialists
Blog: www.michaelridland.com
from freshmvvm.
Yes @rid00z , I have tried, but the items of my menu have some icons and some customization. I don't want a simple list in the Master side.
Thanks.
from freshmvvm.
Please use the built in as an example and implement you own navigation
service.
Thanks
On Tuesday, 29 March 2016, fcogutierrez [email protected] wrote:
Yes @rid00z https://github.com/rid00z , I have tried, but the items of
my menu have some icons and some customization. I don't want a simple list
in the Master side.Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#57 (comment)
Michael Ridland | Technical Director | Xamarin MVP
XAM Consulting - Mobile Technology Specialists
Blog: www.michaelridland.com
from freshmvvm.
Good solution, thanks a lot @rid00z
from freshmvvm.
What is PopToRoot() doing? I couldnt find any explanation for it.
from freshmvvm.
It's pops all pages in current navigation stack.
from freshmvvm.
Any solution for hiding the menu after the click?
i.e. FreshMvvm equivalent to: MasterDetailPage.IsPresented = false;
from freshmvvm.
This worked but it feels like a hack. Would like to know if there is support in FreshMvvm itself:
In App.cs, add a property to expose the main (details) stack:
private FreshMasterDetailNavigationContainer _mainStack;
public FreshMasterDetailNavigationContainer MainStack{
get {
return _mainStack;
}
}
Then in menu view model, you can access this to call the native "IsPresented" property:
public Command MenuCommand
{
get => new Command(async () => {
await CoreMethods.PopToRoot(true);
await CoreMethods.PushPageModel<DetailsViewModel>();
(Application.Current as MyApp.App).MainStack.IsPresented = false;
});
}
from freshmvvm.
Related Issues (20)
- CoreMethods PopPageModel() throws exception when page contains CarouselView HOT 1
- using <Path> in XAML throws TinyIoCResolutionException
- ReverseInit not called HOT 1
- XF 5 MasterDetailPage to FlyoutPage HOT 1
- Correct way to handle Button Clicks and updating the model HOT 1
- Hamburger Menu is displayed in the Content Page in Landscape Orientation - Android HOT 1
- Project status and plans for .NET MAUI HOT 10
- Page not loaded properly for PopPageModel using navigation stack in FreshMVVM Xamarin Forms Android HOT 1
- SetBackButtonTextProperty doesn't work HOT 1
- How to intercept software back button press on FreshMVVM PageModel? HOT 3
- v4.0 Release notes?
- SIGABRT: Popped page does not appear on top of current navigation stack, please file a bug. IOS Xamarin HOT 2
- Can not run sample App in VS2019
- Fody Propertychanged on Viewmodels
- PushPageModel does not work after the app ran in the background
- Implement same bevaviour as at PRISM IDestructible HOT 4
- Update view after update bind property in ViewModel
- Cannot resolve IFreshNavigationService from a page loaded from Notifcation tap HOT 1
- FreshMVVM MAUI support
- Issue 'NavGraph cannot be null' with FreshMasterDetailNavigationContainer since MAUI 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freshmvvm.