We have a Windows Phone 8 application that uses MVVM. There are a couple of pages that work in the following way. Page 1 has some buttons and when one of them is clicked, page 2 is opened.
Now we want to migrate our application to Windows 8. Because of the bigger screen size, we can actually display both the buttons and the content on the same page (see the attached picture). Basically we are going to have a single screen on which we dynamically change a part of it (the right side with green)
We would like to share the view models between the two application. Is there a pattern to use for something like this?
There are a few alternatives that we investigated but we are not sure which one is correct:
Should "some content" (the second page in WP8) be a user control in the windows app?
Should we create a completely new view model for the Win8 that has the code from multiple view models in the WP8 app? This sounds like a bad idea though because we have about 6 view models in the WP 8 app that are now displayed on the same page in the win app.
Should the Win 8 view models somehow "contain" the other view models?
Should the dynamic content (the green box) have its own MVVM?
Ideas? Suggestions?
Well, this depends too much on your application to give any definite answer. But since pressing the buttons will load different content in the W8 app, MVVM can solve this without too much problems.
So, in WP8 app pressing the buttons issues a message that triggers navigation. In W8 you can change that message handler to destroy user control and create new one. In WP8 app your second screen was a standalone page with its own view model, there is no reason to not have a user control on W8 using that same view model.
However, you have to write UI from scrath since XAML cannot be shared.
Related
I have a prism Xamarin Forms application which is being designed for both UWP, Android on IOS. This is the first UWP app that I have created. I want to have a menu that is only accessible from the first level of navigation. To do this, in the past, I have used a Master-Detail page. However, I have encountered some behaviour differences that I need some help with.
When I use a Master-Detail screen on IOS or Android it behaves like a menu only accessible to the first level of navigation. Any subpage that you might navigate from there you don't see menu it is replaced by the back button.
When I use a Master-Detail screen on UWP it's behaviour is different. The menu is available on all pages no matter how far into the navigation stack you travel. It is by default also a menu tray of items anchored on the left side of your application.
I have figured out how to make the menu collapse into the hamburger button that I am used to on an Android and IOS application by setting the parameter MasterBehavior to the value Popover. But I would like to have the menu completely disappear on any page navigated past the first level as it does on IOS of Android.
Does anyone know of a way to make this happen?
I think I can say safely that this can't be done in pure Xamarin.Forms.
To change this you would have to change to which UWP Frame the content is loaded, and I am not aware that Frame is exposed anywhere in Xamarin.Forms which means that even custom renderers cannot help.
However you may try to build the native navigation that would act like that in the UWP project and then load inside those native controls Xamarin.Forms page, that should work and deliver the results that you have requested. Not trivial and no few lines that I can show you, but if that is important for you it should be possible this way.
I am wondering how does the News app on Windows Phone achieve its layout. I am taking about the main page when the app is first launched. It is not a pivot because you can see the next section on the current section. It is not a panorama because the background is not moving, and that it is a universal app so Panorama is not available. It is not a Hub because Hub does not allow you to wrap from the first to last, or vice versa.
I notice this layout is very similar, almost identical to the layout of the Fitbit app. I like this kind of layout a lot and I would like to use that on my own app. If there is a control for it please let me know, if not, how do I do what the developer have done on those apps.
The app is using the Panorama/Hub control. It does not set the title of the control and it does not have an image for it. The first Page/Section does have an image for the main article. this image is only set for that Page/Section. The first section also does not have a Header set (it's blank).
Hope that helps!
Recently picked up WPF about a month ago , decided to design a small WPF navigation application. my design requires a _mainwindow with multiple tile buttons , and click event show a new page, page 1 or 2 which have different content and a back button that takes screen back to the _mainwindow . I have total 5 pages in the application . The problem i am facing is , if i uses NavigationService i have to use pages only and its giving a default navigation bar that i do not require , secondly my design requires pages to be isolated rather to navigate 1 page to an other with navigation bar .
So my question is how can i be able to implement this design with my limited knowledge of WPF or should i have to change the design .
Do you mean the arrows. You can hide them
<Page x:Class="Gabe2a.PageDocFieldDetail"
ShowsNavigationUI="False"/>
i have create a few WPF applications in visual studio, and now i would like to create a final application to run all of the created apps in the final application. i would like to know how i can create a layout that displays the apps that are running inside the final app as buttons that can be clicked and cause the app to expand and allow the user to work on that app and then when finished return back to the final app and see the other apps to choose from. I imagine it would look like a Google chrome blank page that allows you see your familiar webpages and click on them to load them up. Any help or advice on what i should focus on to implement this would be much appreciated.
Thank you for taking the time to read over this.
Consider using a VisualBrush this takes other WPF UI (your "apps") and uses their UI as a brush for another UI element.
Raj Kumar has a simple article called Visual Brush in WPF for details.
The bit you probably want is at the bottom where he shows you rendering a controls content in another control. The magic being binding the controls visual to the element name whos UI it should render.
In the Windows 8 Store App certification requirements it states that your app must support a snapped view. Does anyone know if it's possible to create a single snapped view that persists across the app? For instance on my main view I have 4 buttons that take you to different parts of the app, the buttons do not exist on the other views. What the design team is requesting that I do is create a snap view with the four buttons and some default text describing the app, they want this to be the snapped view for each page.
Is that possible?
Will Windows accept it?
Yes it is possible
Yes it will. I've seen several apps doing this including at least one of the first party apps. Store itself shows static image for snap view.