FreshMvvm
FreshMvvm copied to clipboard
Two pages for one pagemodel
Hello.
This is not an issue, I am seeking help/opinion/advice. Sorry if this is not right place.
My project is supposed to run on phones (Android, UWP) and desktop (UWP). In normal UWP projects I use Adaptive Triggers to adjust UI to different screens.
In Xamarin forms (AFAIK doesn't have adaptive triggers in XAML) however I will probably use method from this blog https://blog.xamarin.com/adaptive-ui-xamarin-forms/
if(Device.Idiom == TargetIdiom.Desktop) page = new DetailsDesktopPage(new MyDetailViewModel(...)); else if(Device.Idiom == TargetIdiom.Phone) page = new DetailsPhonePage(new MyDetailViewModel(...));
As you can see they have more pages for one PageModel. Freshmvvm uses convention over configuration -> page is bind to pagemodel by name. What if I want to have two pages for one pagemodel?
Ofc I can use standard way and set bindingcontext in page's codebehind... but I want to know if there is some better way in framework.
Thank you for your help
I have the same problem , if I click on the multiple ... there appears multiple identical pages
there is no better way so far as I know. you should use bindingcontext defined in the code behind. it is just single line of code. it shouldnt be a big deal :)