WinRT app @ Labdays
Installed win8 on my work laptop not too long ago so I decided to create my first winrt app during lab days at work. Due to lack of imagination I created a simple dashboard app for our product SAFE (really ugly page on saabgroup btw).
Started of by looking at some sessions on channel9 and googled design patterns, frameworks and ended up with the following:
- MVVM Light (nuget: MvvmLight)
- WinRT XAML Toolkit (nuget: winrtxamltoolkit)
- WinRtBehaviors (nuget: WinRtBehaviors)
- ComponentArt DataVisualization (removed the license file from the code)
I ended up writing a custom navigation service that I bootstrapped on application startup to make the IOC container from MVVM Light play nicely together with the AlternativeFrame from WinRT Xaml Toolkit. If you pay attention to the navigation between pages you can notice the nice dissolve transition which is done in AppShell.xaml in only 4 lines of markup.
Once I got the basic architecture in place I noticed that the panorama control from windows phone was missing for winrt. One google search later I found a blog post that addressed this issue so I ended up copying some code since I didn’t want to install the entire nuget package win8nl. What it basically does is to add a panorama behvior to the FlipView control. The sad thing though is that you can’t flick the screen if you don’t have a touch screen, which is extremely frustrating!
As for what goes for component arts data viz library I really think it’s not worth to pay for (trial is free), in the short time I played around with it I stumbled upon several bugs. An ugly work around for the PieChart control can be seen in the code behind file MainPage.xaml.cs. When data binding to an observable collection the control goes bananas as items are added to the collection, I needed to reset the DataSource for each added item for it to work properly.
All and all I’m pretty satisfied with the choice to use MVVM Light together with WinRT Xaml toolkit and the custom navigation service, I will definitely reuse that part for other projects.
Anyways the result can be seen in the vid below, you can get the source code here, if you’re interested in how I hooked up the components and architecture. You will probably not be able to run the application since it requires our back-end and I didn’t spend too much time on exception handling.
Merry x-mas everybody and a happy new year, I’m off for two whole weeks!
Leave a Reply
Want to join the discussion?Feel free to contribute!