FreshMvvm icon indicating copy to clipboard operation
FreshMvvm copied to clipboard

Two pages for one pagemodel

Open mattokar opened this issue 7 years ago • 2 comments

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

mattokar avatar Nov 21 '17 12:11 mattokar

I have the same problem , if I click on the multiple ... there appears multiple identical pages

luyi1009 avatar Nov 29 '17 02:11 luyi1009

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 :)

EmilAlipiev avatar Jan 04 '18 00:01 EmilAlipiev