Category Archives: Silverlight


Why I think Windows Phone is superior phone OS?

Windows Phone? How did that happen?

Well over the last couple of months i was experimenting with mobile devices a lot because i was kind of tired of the Desktop and the whole HTML5 madness (yes i don’t like Java Script that much and i certainly don’t think its the-way-of-the-future, but that’s subject for another post).

Out of desperation at first i tried Android and got me a LG Optimus One phone. And I must admit that i liked it very much.

Yes, battery lifetime was problem at start, but installing CyanogenMod custom ROM completely solved that. I even spent some time programming an Android game but that failed miserably because my productivity was close to zero considering all the new things i needed to learn (Java, Open GL).

And all that time one good friend was constantly telling me how great his Windows Phone was. I was very skeptical about that since I previously owned Windows Mobile 6.5 phone  and it was complete failure. I even recall at some time in the past promising to my self that i will never buy Windows powered phone again!

But after hearing all the good things about new Microsoft phone OS I eventually decided to give it a try and got me a Samsung Focus with Windows Phone Mango installed.

Boy was i pleasantly surprised.

And lets be honest here: its not that i did not like Android.  Its good and mature mobile OS.
Its (kind of) Open Source and its has significant market share – not without good reason.

But using Windows Phone after Android was a really pleasent and refreshing experience. And there is no way I’m going back.

Disclaimer: before I continue i want to make few things clear: i don’t work for Microsoft, and i never did and probably never will. Everything i say on this blog is my personal opinion and not of my neighbors or my dog.

So now let me try to summarize the things i

personally love about my new Windows Phone:


  • Superb UI - The whole phone User Interface is absolutely AMAZING!  Its very simple and intuitive.
    Yet at the same time it manages to stay slick and beautiful with subtle animations and transitions that do not annoy user but enhance the overall UI experience and make it fun and pleasant.
    UI team did a great job – without any compromises. This is huge win for the platform.
  • Live Tiles – When we speak of the User Experience I must mention the excellent Live Tiles concept.
    Live Tiles are actually just animated squares on your home screen  that represent applications or shortcuts for documents, contacts, URLs or any other static/dynamic piece of information that you can pin and arrange on your mobile ‘desktop’.
    They are called Live for a good reason – they often change their content to show additional information – like number of emails in inbox for email application Live Tile, current temperature for weather app Live Tile etc.
    I like this because it works great for the limited screen space of the phone – each of the tiles can show more info by flipping to display live content as it becomes available/relevant.
  • The phone Just Works – From the practical everyday usage perspective the OS feels very natural and in 99% of cases works exactly as you think it will.
    I have to admit that i never expected this from Microsoft but the whole Windows Phone is so well planed and designed that its never in the way when you are using it. One good example is how built-in music player works with non-standard headphones.
    I tried plugging in the headphones from my old Android phone (it’s a different manufacturer) and I was able to control music playback by pressing the hardware button on the headphones, one press for play/pause, double press to skip current track. Yes I know this is minor and expected thing, but  remember i found this out just by trying and expecting that it should work, and it ‘just worked’  even with non-supported headphones.
    And when you use the phone you often catch yourself thinking ‘Wow this works just as I expected it to work’. After few moments like that and I was already bought.
  • General Email experience is great! In my opinion its superior when compared to the built in email clients on IPhone or  Android. And I don’t mean just MS Exchange email.
    I’m a long time Google Mail user and i don’t use Exchange Server at all. So i was little worried how this will work with MS phone – but without any reason.Gmail works flawlessly out of the box without ANY additional  apps or customizations. I  just added my Google account and it worked. Even the push notifications worked without a single glitch. It also synced my Google Email Contacts and Google Calendar  in expected way, no fuss.
  • Built in keyboard is great! Unlike Android you cannot replace keyboard with 3rd party replacement, but there is really no reason for you to do so any way.
    Default keyboard flawlessly supports multiple languages – I’m using English and Czech settings and i can enter all the Czech special characters very easily (they appear by long pressing the keys – as expected).
    Actually I’m deliberately writing this post on the phone using that same keyboard just to prove the point (therefore don’t mind my spelling, please).
    Copy and paste works very nice and another thing i like is the caret repositioning – just by long pressing the screen and then moving the caret around – i would love to see this working so nice on Android.
  • Multitasking experience is very nice at least in the Mango Windows Phone version that i have.
    Actually there is no real multitasking (if you exclude the occasional background data sync) because only one app is active at the moment. Others are ‘tombstoned‘ until you activate them.
    But there is very nice illusion of multitasking that does the job pretty well.
    By long pressing the Back hardware button you get on the screen very cool visual ‘Task Manager’ where you can see list of your app screens which you can scroll through and choose which app you want to activate now.
    Simply brilliant.
    On the other hand Android has true multitasking but list of running apps is hidden in phone settings and not so slick at all.
  • Phone and SMS functionality – Simple, quick and feature rich yet not in your way when you want to do quick call or SMS somebody. And I could hardly say that for Android or IPhone. Very impressive.
  • TextToSpeech and SpeechToText – Windows Phone has pretty decent voice recognition and when you use wireless or wired headsets you can set it up so that it reads you your SMS messages and you can reply to them over voice command and then dictate your answer. Have a look at this Windows Phone voice commanding demo if you want to know more. Yes i know its not Siri and it can be much better but even as it is now is quite usable if you are native English speaker.
  • Marketplace – Even though there are less apps then for other platforms, there are enough of them and number is growing so time will fix that. But generally speaking Marketplace is already mature and useful.
  • Social Networks integration is flawless. Again without any third party tools.
    Facebook, Twitter, LinkedIn you name it. Its all integrated into People hub on the phone, so you can merge Facebook account with your SIM card phone contact to use it as his/hers account picture etc.
  • do i need to mention that phone integrates nicely with desktop MS Office? OneNote, Word, Excel it works as good as it can get on a mobile device. I don’t use it too much except for OneNote but i think its huge win for corporate users.
  • Built in Music Player and Radio app are great and i enjoy using them for they simplicity and stability. Not a single crash. Try that on android device and good luck trying!
  • One big advantage of Windows Phone for .NET software developers especially for Silverlight folks is that programming Windows Phone is very familiar experience.  Visual Studio has very good support for phone development and Emulator for Windows Phone is in my personal opinion much better and faster then Android one. (Off course one could say I am biased since I’m .NET developer but speed is something that is easily measurable).
    If you have .NET background you can start app development or XNA game development in no time.
    And the Marketplace is not overcrowded. Anyone mentioned word Opportunity?
  • Another small thing that can be a lifesaver is the phone boot time.
    My Samsung Focus boots in 20 seconds and its immediately ready to make phone calls or to write SMS.
    My Android device was not even close to that and even when it was booted it remained to be slow for some time, probably until Micro SD card is initialized and until all the services are up and running.
    Sometimes when you need to make an urgent call this can be really important feature.
  • Every Windows Phone has built in Find My Phone feature that allows you (if you enable it) to see on the map where is your phone and to start the Ringing on the phone, Lock it or Erase it (off course it needs to be connected on the network for this to work).
    This is useful if you lose your phone, or if it gets stolen. I’m not sure about IPhone but I know that on Android you need to install third party apps for this so this is another nice benefit of this platform.
  • Battery Saver – if enabled phone automatically switches to power saving mode when battery is low (stops background sync for example)  and your phone calls and SMS functionality continues to work until there is juice in the battery. I really like this because after all this is a phone device so my calls are more important then my Facebook updates :)
  • Lock Screen on Windows Phone is beautiful. It is following the general minimalistic approach but still manages to show all the relevant information – calendar items, missed calls, messages, emails etc. If you are playing some music there are small controls there.
    All in all very nice without unnecessary bells and whistles.

I could continue like this for some times because there are many other nice things that deserve mention.

But at the same time this is young phone platform so there are also some problems to be addressed.

The biggest issue I currently see for Windows Phone is that its not open enough for developers. Many OS features are exclusively used only by OS apps and by Vendors apps and everyday developers don’t have APIs to access them. Much has been written on the subject so I wont repeat it here, so read the post 10 ways to improve Windows Phone 7 if you are interested or WP7 Extensibility Rant from same author.

Typical example is that in 3rd party apps you cannot subscribe to some user invoked actions, for example there is no way for user to send url to non system application.

I dont see anyone benefiting from this kinds of limitations.

I really hope that Windows Phone team will address these problems and give developers more power.

There is WPDev User Voice Feedback site where all the requests from the developer community are listed – so there is hope this will change soon.

Another thing I don’t like is that for some settings there is no quick way of access.
For example WiFi or Flight Mode. In order to manipulate them you need to go to System Settings and choose menu item  and then switch them on or off. Instead of this hassle I would like to have quick toggle button somewhere on the phone desktop.

Again this is something that would be solved if developers could have access to those settings to programmatically manipulate them.

I guess Microsoft do not want to open the Pandora’s Box by giving  too much power to 3rd party apps, but I think they over did it in this case.

Right balance between opennes and system security on Windows Phone needs yet to be determined.

I would also love to see support for more languages for Text To Speech and Voice Recognition. Im not sure abut Microsoft plans but this would be a killer feature since i think voice is the way to go when it comes to the future of mobile platforms.

Wow this was longer post that I originally intended it to be!

I hope I was able to explain why I personally choose Windows Phone over other modern phone platforms.

Then again, this is all my personal experience and your mileage may vary.

It all depends on what you expect from your phone:

  • If you want to pay for Brand, then simply buy IPhone.
  • If you want phone that does everything you want and that is completely customizable yes often fails because its complex and bloated with unstable apps – get Android.
  • if you just wont cool phone that dont stand in your way but does all things you really could need from mobile device – i recommend Windows Phone

I don’t really expect my phone to be Swiss army knife capable of EVERYTHING but failing to do anything efficiently.

I like minimalistic approach and simplicity so probably this is why I like Windows Phone so much.

But the war of the platforms is still on so don’t be surprised if tomorrow I choose another :)

Those were my 2 cents on the subject, let me know what’s your experience and what is your best mobile OS out there, and most importantly: WHY?


Lighthouse – Silverlight Unit Test Runner Project released

Unit Testing in Silverlight? But you need Web Browser to do that!

No you do not! Ok maybe you do. But not in a direct way. I will clarify that later. Lets first go back in time to the root of the story:

Since the initial release of Silverlight i was really annoyed by the fact that Unit Testing had very slim support.

Even later when Silverlight Unit Testing Framework was introduced by Microsoft things became little better but still it was far from good.

You could create Unit Tests, but you had to start your Visual Studio in order to run them – eventually looking at the results of tests in your favorite Web Browser.

That ruled out one of the most important facets of Test Driven Development – running your Unit Test on Continuous Integration server, so that you can easily see when any of your Unit Tests are broken – in other words treating your Unit Tests equally as all your code, like you should.

Not to mention that there was no way to run Unit Tests from Reshaper! (oh boy don’t even let me get started on that one).

Can feeling of anger be a motivation for good deeds?

Very likely. I started by investigating what open source projects were available to fill these Silverlight TDD gaps.

And i did found few of them. But they were either too complex or simply did not work properly and failed to run tests from one reason or the other.

This is how i decided to create project Lighthouse – probably in same way how many other open source projects are born: to scratch an itch of single developer, for the benefit of the community :)

What is it for? What’s the Roadmap?

Lighthouse is envisioned as project that will host multiple tools that will allow Silverlight developers to do Test Driven Development much easier then before.
First tool in this project Silverlight Command Line Unit Test Runner has just been released on Codeplex website.

Lighthouse Command Line Unit Test Runner is console application that runs given Silverlight Unit Testing Framework Unit Tests and collects their results and saves them in known NUnit XML Unit Tests results file format on your hard-drive.

What can i expect?

The rule of the thumb goes like this:


In other words: If they failed in browser, they will fail when you run them via Lighthouse in completely same way (same timing, same exception etc) – and vice versa.

You can use Lighthouse to run tests in XAP packaged application or you can use it to run tests directly specifying your Silverlight DLL’s – it is very flexible.

Currently Lighthouse saves results in NUnit XML Unit Tests results file format so that means you can use it to run your Unit Tests in ANY Continuous Integration server that supports this format – CCNet, Team City you name it.

In future we will maybe add more output XML formats, but for start this should suffice.

Lighthouse Silverlight Command Line Unit Tests runner supports variety of command line switches so you can tweak it to work how you need it.

You can specify Tag Filter to run only certain test cases.

You can specify timeouts, output log file, output directory etc.

Make sure you visit the Lighthouse Command Line Test Runner Documentation page to get familiar with all the options.

In the future we are planning to develop Resharper plugin to run Silverlight Unit Tests, but you will here more on that when its ready.

And how does all this work?

Its much simpler to explain then it was to make it work:

In its essence, Lighthouse analyzes your XAP/Assemblies and modifies them in a way so that it can control the Unit Test execution. It then fires up a web browser instance in the background and start this modified Silverlight application and collects the results of all Unit Tests. Results are saved in XML file and everyone go home and live happily ever after.

What now?

Until future releases I’m asking all interested Silverlight developers to use Lighthouse and send us feedback or even join the Lighthouse team to make it better.

For the end check out this short video where Lighthouse Command Line Runner executes Silverlight Unit Tests from Sterling project:

Stay tuned…

Microsoft Silverlight 4 Certification, is it worth the ride?

Roboblob's Silverlight 4 Microsoft Certificate
Silverlight 4 Microsoft Certificate

Now some good news folks: I received the confirmation that I successfully passed the Silverlight 4 Microsoft Certification.

I was too busy to immediately brag about it and write a show-off post so I will here just quickly share my thoughts on how all this went before my brain moves these impressions to non-accessible-memory-banks-prepared-for-deletion.

First of all I must admit that I was pretty sceptical about the whole certification thing. I’m not big fan of certifications in general and I find it a bit overrated – who cares about fancy printouts people are framing on their walls. You either know how to do your job or you don’t and some poster with Microsoft stamp on it wont change that in any way.

But at that time (it was 3 months ago) Silverlight 4 Exam was beta test (you could take it for free) and in that period of time I was switching my corporate job to become a full time Silverlight developer so this seemed like perfect opportunity to test my knowledge – and I applied.

Honestly I did not had enough time to prepare for the test – even though I was planning to do so. Simply could not find the time or strength to study and eventually I had to go for a test without any especial preparations – all I had was my hands-on experience in writing Silverlight code and few books I have read on the subject along the way.

Naturally I expected lots of theory mumbo-jumbo in the test so I was sure I will fail-fast :)

But to my surprise the test was mainly pragmatic with questions from real-world Silverlight programming practice so it turned out I did pretty good after all.

It was interesting that some parts of the test required knowledge of MVVM pattern – just as if they asked me what to put there :D

All in all test turned out to be more serious and realistic than I expected so this is +1 for old Microsoft.

In case any one of you want to take the test and don’t know how to prepare I have two things I could recommend:

  1. read THE book: Pete Brown’s Silverlight 4 In Action – Its the best Silverlight book I have read so far and covers most of the knowledge needed for the exam.
  2. Mark Monster also participated in the Beta Silverlight 4 testing and blogged about how he was preparing for it so this is also worth reading.

All in all this was fun ride, and now I’m looking forward to Silverlight 5 Certification announcements :)

Introducing the Prism Navigation Framework for Silverlight MVVM Applications

Another framework? But why?

After receiving a lot of positive feedback and requests for source code for my previous post on Prism navigation i decided to release the code i had as open source project.

This is how Prism Navigation Framework project was born.

My intention was to create simple-to-use but powerful-and-feature-full Navigation Framework for building Silverlight MVVM applications with Prism.

This is the first introductory post (from series of planned similar posts) that will try to explain what this Navigation Framework for Prism can do to make your life as developer easier.

If you are too anxious to read the whole article you can just open the Sample Silverlight Navigation Application Application (for the Beta 1 version of the Framework) and try out some of the features and then read on if you find it to be interesting (in the demo you can see loading Views and their ViewModels to Prism Regions, visual transitions when loading Views, Browser URL and History integration – deep linking, deferred module loading, passing parameters to views etc).

If you are interested in the source of the Prism Navigation Framework and the Sample Application shown here you can download it on the Downloads section on the project site.

Note: Its important to say here that in this post I will not try to explain in detail how Microsoft Patterns and Practices Team Prism works – you must already be familiar with it, and if you never used it to develop Silverlight or WPF MVVM applications, i recommend you to try it out, also make sure to check Prism excellent documentation if you need to refresh your memory.

Basic Concepts

Since Prism Navigation Framework is based on the Prism guidance, naturally it is leaning on and reusing all of Prism main concepts:

  • Modules – packages of application functionality (packaged as .dll or .xap) – they can be loaded immediately on application start or on demand (so called deferred module loading) – this framework completely supports loading of modules implicitly or explicitly.
  • Views and their ViewModels that are packaged in those Modules (each View has its ViewModel set as value of its DataContext property) – this framework allows you to register Views and their ViewModels and then easily load them in many ways, initialize them with parameters etc.
  • Regions - are actually Controls that are used as placeholders on the Views where you can load content – other Views of the application – this framework supports Regions and extends them in practical way – read more below.

One Region To Rule Them All

If you ever built Prism applications you know that by convention each Prism application has one Main View – called the ‘ShellView‘.

Shell View is created on the application start and loaded to represent the main screen of the application.

This main View has multiple Regions – this is where you can load your Views.

Prism Navigation Framework takes Prism’s concept of Regions a little further and defines two types of regions:

  1. Single Main Region – there is only one Main Region in the Application and its usually large region in the center of the Shell View. This Region is meant to be placeholder where we will load other Views – Pages of the Application with the main content. Only one View can be shown in Main Region at one time. This region is represented by dropping instance of PrismNavigationMainFrame control in your ShellView and setting its RegionName.
  2. Multiple Secondary Regions – represented by PrismNavigationSecondaryFrame control – you can place as many of them as you like in the Shell View and load any of application Views into any of those Secondary Regions – Secondary Region can (unlike the Main Region) show multiple Views at the same time (widgets, control etc).

Here is how you would add the single Main Region to your Shell View:

                    <Controls:PrismNavigationMainFrame cal:RegionManager.RegionName="MainRegion" />

And here is how you can add multiple Secondary Regions:

                    <Controls:PrismNavigationSecondaryFrame cal:RegionManager.RegionName="WidgetsRegion" />

                    <Controls:PrismNavigationSecondaryFrame cal:RegionManager.RegionName="OpenedDocumentsRegion" />

Loading Views

We have seen how we can define Main and Secondary Regions so lets see what are our options for loading our Views into those Regions:

  1. First and most useful way to load View into Main region is by typing meaningful URLs in the Browser. Our Framework supports convention over configuration so some defaults work out of the box, for example if you have View control called DetailsView in Module called ProductsModule, then to load this DetailsView into the Main Region of the application just point your browser to this URL: (Off course you can pass parameters through the url like this:  or
  2. you can also use standard Silverlight HyperlinkButton control and its NavigateUri property to specify URL of the View you want to load (for example “/Products/Details/Id/1″) and its TargetName property to specify to which Region you want View to be loaded
  3. and from your code in ViewModel use the framework’s IPrismViewLoadingService and load Views to any Region in multiple ways: by specifying the View type, or View interface type or just a string name of the View – choice is on you (more on that later). Its important to mention here that when view is loaded via URL – Prism Navigation Framework automatically checks from the URL what is the name of its Module and loads the module if its not already loaded before loading the View, but more on that later.

Modules And How They Relate To Their Views And ViewModels

Now that we covered how to load Views, lets see how the Views and ViewModels are defined, created, registered and initialized in your MVVM application done with Prism Navigation Framework:

Views and ViewModels are in Prism applications packaged in Modules - each module is Silverlight Library (packaged in .dll) or Silverlight Application (packaged in .XAP) that supports some application functionality.

View is usually a UserControl that is just a visual representation of the functionality and its bound to its ViewModel for the data and application logic.

Each module in Prism has to implement IModule interface and it contains InitModule method that is called by the Prism when the Module is loaded.

This is where you need to register your Views and ViewModels so that Prism Navigation Framework can help you instantiate them and load them into Regions.

So here is how your typical Module initialization would look like:

    public class InitModule : IModule
        private readonly IViewRegistrationService _viewRegistrationService;

        public InitModule(IViewRegistrationService viewRegistrationService)
            _viewRegistrationService = viewRegistrationService;

        public void Initialize()

This is possible because each ViewModel needs to inherit the generic type ViewModel<IView> and therefore carries the type (or interface) its View.

This way RegisterViewsAndTheirViewModels method can automagically scan the calling Assembly and look for the types that inherit ViewModel<TView> and registers them for you.

Here is how typical ViewModel definition looks like if you tie your ViewModel to the View interface type:

    public class IndexViewModel : ViewModel<IIndexView>


But off course you can also tie your ViewModel directly to the View type if you want (but i don’t recommend that you do this, tying ViewModel to View interface is much cleaner):

    public class IndexViewModel : ViewModel<IndexView>


Naturally, nothing stops you from manually registering your Views and ViewModels in your Module initialization like this:

    public class InitModule : IModule
        private readonly IViewRegistrationService _viewRegistrationService;

        public InitModule(IViewRegistrationService viewRegistrationService)
            _viewRegistrationService = viewRegistrationService;

        public void Initialize()
            this._viewRegistrationService.RegisterViewAndViewModel<IUserDetailsView, UserDetailsViewModel>();

As long as you use any of these methods of View-ViewModel registrations – your navigation will work.

View Initialization

So now that we know how to register our Views and ViewModels lets see how ViewModel initialization looks like.

Since base class ViewModel implements IAcceptInitializationData interface it is ready to accept initialization data like this:

    public interface IAcceptInitializationData
        void Initialize(ViewInitializationData initializationData);

So whenever some View needs to be shown, behind the scenes its ViewModel will be created, and its Initialize method will be invoked with initialization data (that includes parameters from URLs or directly passed if its done via code) and afterwards this ViewModel will be set as DataContext of the View and then View will be shown in desired prism Region by our Navigation Framework.

Lets take a look at the ViewInitializationData class that is passed to the ViewModel:

    public class ViewInitializationData
        public string Url { get; set; }

        public string RegionName { get; set; }

        public Dictionary<string,string> Parameters = new Dictionary<string, string>();

As you see its enough data for the ViewModel to start functioning – it knows where its loaded – RegionName, how (if via URL then corresponding Url property is filled), and it gets its parameters via Parameters dictionary.
Parameters are parsed from the URL automatically by the framework so you dont have to worry about it.

Can I Show Views From Code in ViewModel?

If you are showing the View from the code, you can pass to it new instance of ViewInitializationData type where you can set your parameters etc.

Also its worth mentioning that if you show some View from code into the Main Region and pass parameters to it, then Browser URL will be updated to show the Url of the View showing the Module name, View name and parameters if any.

For example if you loaded DetalsView from ProductsModule with parameters ProductId = 1234 browser URL would change to something like this:


As you can see the Prism Navigation Framework can do a lot of plumbing for you, so that you can focus on the implementation of the application functionality (don’t we all want to do that?).

In order to achieve all this framework is extending the Prism so it needs to call some initialization code in the Bootstrapper class.

To avoid forcing users to manually call that code in every application there is special class PrismNavigationFrameworkUnityBootstrapper that you can use instead of the regular UnityBootstrapper that will do all this initialization for you (for now MEF is not supported by this framework but maybe we will include it later).

So in your application bootstrapper that inherits PrismNavigationFrameworkUnityBootstrapper you don’t need to do anything other than what you would usually do, just create your Shell and register Modules etc, something like this maybe:

    public class Bootstrapper : PrismNavigationFrameworkUnityBootstrapper
        protected override DependencyObject CreateShell()
            this.Container.Resolve<IViewRegistrationService>().RegisterViewAndViewModel<ShellView, ShellViewModel>();
            return Container.Resolve<IViewCreationService>().CreateView<ShellView>() as DependencyObject;

        protected override void InitializeShell()

            Application.Current.RootVisual = (UIElement)this.Shell;

        protected override Microsoft.Practices.Composite.Modularity.IModuleCatalog CreateModuleCatalog()
                Microsoft.Practices.Composite.Modularity.ModuleCatalog.CreateFromXaml(new Uri(
                    "PrismNavigation.App;component/ModuleCatalog.xaml", UriKind.Relative));

Wrap Up

This is just an introductory post and here you could see only part of what you can expect from this Framework.

I wont go into further details for now, so expect in the future more posts covering every feature of the Prism Navigation Framework in more details.

In the meantime check out the Prism Application Framework Sample Application just to get a feel of what it can do, or browse the latest Source Code or download it and use freely for building your next big Prism Silverlight MVVM application.

Your feedback (both positive and negative) and participation in the development of the project is very welcome!