Mike Taulty's Blog
Bits and Bytes from Microsoft UK
Windows/Phone 8.1, Prism Universal Early Drop, Migrating a Demo to be Universal

Blogs

Mike Taulty's Blog

Elsewhere

Archives

Combining a couple of blog posts, I thought I’d take the demo that I showed in the video on this post;

Windows 8.1 Apps- Updated Prism for Windows Runtime Session

and apply the pre-release bits that were in this post;

Phone 8.1- Prism for the Windows Runtime (Universal)

and see how I can put together that 2-page “Contacts” app;

image

in a Universal way. To make life easier for myself, I put this into a few different video segments.

Part 1 – Getting a Blank, Shared Project Up And Running

With that in place, I can start to run through putting my demo back together from the point of view of building out the Windows app while trying to make as many things shared as is possible. Given that I’ve recorded that video before, I’m not going to go through it blow-by-blow but, instead, I’m going to break it down into implementing the initial page and then the secondary page and I’ll pull out the bits and pieces that are interesting/blockers along the way.

Part 2- First Page Up and Running

Part 3 – Details Page Up and Running

The second page in that “Contacts App” has a little more complexity than the first one in that in the demo I build it up to allow for suspend/terminate and I add some validation and I add a confirmation dialog and then some portrait/landscape kind of functionality.

None of that is overly complex, it’s just more than happens on the first page.

Part 4 – Tailoring for Windows/Phone

The last part for this particular piece of demo code is to try and fix that Phone UI because it’s simply sharing the Windows UI with its generous margins and so on and that really isn’t going to work. I ended up taking the approach of making a Windows/Phone specific “Frame” for each page and then embedding a common user control into the middle of that. Here’s the breakdown;

and, for the moment, that’s where I got to in taking that previous Prism demo code and making it “Universal”. The main learning for me in that was around the missing validation functionality – that needs some thought on my part.

The code (quite sketchy) as of the time of writing is here.


Posted Wed, Jul 9 2014 10:27 AM by mtaulty

Comments

Mani wrote re: Windows/Phone 8.1, Prism Universal Early Drop, Migrating a Demo to be Universal
on Wed, Jul 9 2014 4:41 PM

Great timing. I was looking into this a couple of days ago for my Universal app, regarding movie reviews and wished Prism was available for WinPRT. I might give this a try, but am not keen on putting views in the Shared Project. It feels like too much of a hassle.

Terrence wrote re: Windows/Phone 8.1, Prism Universal Early Drop, Migrating a Demo to be Universal
on Wed, Jul 9 2014 8:44 PM

Mike your posts on Prism are fantastic.  Please keep them coming.

mtaulty wrote re: Windows/Phone 8.1, Prism Universal Early Drop, Migrating a Demo to be Universal
on Thu, Jul 10 2014 11:27 AM

Terence,

Thanks!

Mike.

mtaulty wrote re: Windows/Phone 8.1, Prism Universal Early Drop, Migrating a Demo to be Universal
on Thu, Jul 10 2014 11:28 AM

Mani,

I hear you - bear in mind that you don't have to necessarily put everything into Shared projects. That's just one approach I took here.

That said, it does give you the advantage of playing "compilation tricks" in the sense that you can effectively compile the same source twice and use techniques like conditional compilation to have two versions of the truth whereas if you build one library then it has contain one piece of code.

( I'm guessing that you know all this already :-) )

Thanks,

Mike.

South Coast Developer wrote re: Windows/Phone 8.1, Prism Universal Early Drop, Migrating a Demo to be Universal
on Wed, Jul 23 2014 9:19 PM

In order to find the Shared Project (Empty) Project template in Visual Studio, I had to also install the Shared Project Reference Manager extension from visualstudiogallery.msdn.microsoft.com/315c13a7-2787-4f57-bdf7-adae6ed54450

mtaulty wrote re: Windows/Phone 8.1, Prism Universal Early Drop, Migrating a Demo to be Universal
on Thu, Jul 24 2014 11:44 PM

South Coast Developer,

Yes, that's right - I think I mentioned that in the previous post referred to from the top of the page. Sorry for not mentioning it explicitly here again.

Mike.

taedori wrote re: Windows/Phone 8.1, Prism Universal Early Drop, Migrating a Demo to be Universal
on Wed, Jul 30 2014 12:25 AM

Thanks Mike.

it is a great help!

Question!

how do you resolve ViewModelLocator.AutoWireViewModel property in windows phone app?

it says "your view must implement IView."

VisualStateAware page implemented IView interface.

taedori wrote re: Windows/Phone 8.1, Prism Universal Early Drop, Migrating a Demo to be Universal
on Wed, Jul 30 2014 12:27 AM

It is a great help!

but I have a question.

In MagePage.xaml, how do you resolve "prismmvvm:ViewModelLocator.AutoWireViewModel="True" in windows phone version?

ErrorMessage is "your view must implement IView"