简体   繁体   中英

Using Monocross on Windows Phone 7 with Panorama and/or Pivot control

I love the Monocross idea but am a bit lost for Windows Phone 7 when I want to use a Panorama and/or Pivot control. The only view provided is the Page view. So navigating from one page to another works great! But now I want a Pivot or Panorama. Basically I could create a new controller for this view, but do get the "pages" inside the controls. The navigate does really Navigate to it, but not inside the Pivot / Panorama.

For Monotouch and MonoDroid samples have been prepared how to do this (basically a new viewcontroller was created). But WP7 has been left behind.

Anybody?

I am also doing cross platform development using mono and like you and many others face the problem of what to do with respect to the user interface and other underlying hardware integration.

I decided that I did not want to be at the mercy of yet another third party framework (mono is enough) and researched for a solution that I could build and maintain myself. The new MVVM pattern along with Expression Blend is really cool but soon you find yourself stuck when it comes to cross platform development.The MVC an MVP patterns also did not seem to suit what I needed. Finally settled on the PM pattern and expanded it into a PMH where the H is for hardware. To achieve what I needed I had to abstract the fundamental widgets (buttons, panels, textboxes) into a underlying platform layer for each device type. My platform layer represents around 1% of my code base and allows me to skin the application for each device I target it for.

For my WP7 solution I use hardly any HTML only around 25 lines which is enough to initialise the application and the main page. The rest of the user interface is put together programmatically just like I would in WinForms. On WP7 I still make use of the Pivot control as it really is pretty groovy and am modelling a similar control for use on Android/iPhone. While it wont be 100% the same it will be very similar and still use the same navigation engine within my core code.

I am not complete with my development yet but so far I am very happy with my progress. I have been developing user interface for Windows application for some 20 years and I never use the interface builder tools as I find they never give me what I want and really waste my time (Blend is pretty cool though) and also create a tremendous code bloat especially in Blend.

I can't entirely help with monocross - I did do a sample for droid once - https://github.com/slodge/monocross-tab-activity-view - but I never completed the wp7 part of that.

For mvvmcross... which is related... there's a couple of samples - one in the tutorial (a bit hacky!) and one in the conference app - much the preferred sample.

The basic technique I choose was to use sub-viewmodels for each "tab" of the panorama - see how the databinding DataContext is set for each Item in https://github.com/slodge/MvvmCross/blob/master/Sample%20-%20CirriousConference/Cirrious.Conference.UI.WP7/Views/HomeView.xaml

Note that in a bigger app there may be important memory issues to consider when doing this - especially when using a pivot control which does not load all pages into memory at the same time (so you don't really need to load all viewmodels either)

Some bloggage on the conf app: http://slodge.blogspot.co.uk/2012/03/update-on-mvvmcross-sqlbits-conference.html

And the final sql bits source: https://github.com/slodge/MvvmCross/tree/master/Sample%20-%20CirriousConference

标签和透视示例

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM