Must-have NuGet packages

NuGet is awesome! There are so many packages though that it’s very difficult to know which ones are useful and which can be missed.
Therefore I have created a list of the NuGet packages that I find most useful when developing for Windows Phone and Windows 8. So here you go:

JSON.NET

Although JSON serialization is built-in for Windows 8 and Windows Phone 8, JSON.NET just does a better job:

  • It’s faster (.NET serialization performance comparison)
  • The API is clearer (that’s a personal opinion)
  • It’s highly configurable. This is necessary when you want to serialize class hierarchies, apply some custom logic or basically anything that is not just standard serialization
  • It has support for LINQ to JSON

PM> Install-Package Newtonsoft.Json

 

MVVM Light

The preferred method of developing for Windows 8 and Windows Phone 8 is using Model-View-ViewModel. This package adds the following utilities to your toolbox:

  • A ViewModelBase-class which has properties for detecting design-mode
  • A RelayCommand which implements ICommand and lets you create lambdas for your commands (as opposed to subclassing ICommand for every command)
  • Messaging infrastructure
  • EventToCommand behavior

PM> Install-Package MvvmLight

 

Ninject

When using MVVM and developing for testing, the key is avoiding dependencies. That’s why MVVM Light comes with it’s own built-in dependency container. However, in most circumstances you need a bit more control over how your dependencies are resolved, the lifetime of your objects and partitioning certain areas in your program. That’s where Ninject comes in. Ninject has a very clear API, excellent documentation and is supported on all the different .NET platforms. For Windows Phone and Windows 8, it’s best to install the portable version as this will ensure compatibility.

PM> Install-Package Portable.Ninject

 

Bindable Application Bar (Windows Phone only)

The application bar in Windows Phone is an odd component. As opposed to all the other controls in the framework, the application bar is not really a Silverlight control but a native control. Because of this, databinding is not possible.
With this package you can use the application bar with databinding and have something like this:

<bar:Bindable.ApplicationBar>
    <bar:BindableApplicationBar
        IsVisible="{Binding BarIsVisible}"
        IsMenuVisible="{Binding IsMenuVisible, Mode=TwoWay}"
        IsMenuEnabled="{Binding IsMenuEnabled}"
        ForegroundColor="{Binding ForegroundColor, Converter={StaticResource DoubleToColorConverter}}"
        BackgroundColor="{Binding BackgroundColor, Converter={StaticResource DoubleToColorConverter}}"
        BindableOpacity="{Binding Opacity}"
        Mode="{Binding Mode}"
        MenuItemsSource="{Binding MenuItems}"
        ButtonsSource="{Binding Buttons}">
        <bar:BindableApplicationBarButton
            Text="XAML Btn 2"
            IconUri="/Icons/Dark/appbar.next.rest.png"
            Command="{Binding TestCommand}"
            CommandParameter="{Binding TestCommandParameter}" />
        <bar:BindableApplicationBar.MenuItems>
            <bar:BindableApplicationBarMenuItem
                Text="XAML MnuIt 2"
                Command="{Binding TestCommand2}"
                CommandParameter="{Binding TestCommand2Parameter}" />
        </bar:BindableApplicationBar.MenuItems>
    </bar:BindableApplicationBar>
</bar:Bindable.ApplicationBar>

PM> Install-Package BindableApplicationBar

 

Tombstone (Windows Phone only)

When using MVVM in Windows Phone, setting up tombstoning correctly can be cumbersome. You need to route the application and page events to your ViewModels. This package lets you control tombstoning through the use of attributes in your ViewModel. It requires minimal setup and is very easy to use.

For more information check my post Tombstoning made easy in Windows Phone MVVM

PM> Install-Package WindowsPhone.MVVM.Tombstone

  • Pingback: Must have NuGet packages for Windows Phone and Windows 8 apps

  • krisW

    When someone’s telling me that something is “must have” I’m starting to hate it.

  • krisW

    and by the way, what is “nuGet”, is it also must-have, really?

  • http://kamranicus.com/blog Kamran Ayub

    I would also add:

    - PhoneThemeManager
    - Windows Phone Toolkit (WPtoolkit)

    And if you’re using async/await:

    - Microsoft.Bcl.Async
    - Microsoft.Net.Http
    - AsyncOAuth

    And for bugs, http://bugsense.com (they have a WP7 and WP8 SDK)

    • Kenneth Truyers

      Thanks for the tip on PhoneThemeManager, I didn’t know that one.

      The async/await are handy if you’re developing for WP 7, otherwise they’re not necesarry since it’s already built-in

  • Morten

    You forgot SharpGIS GZip webclient. Every time someone makes a web request without gzip, a baby seal gets clubbed to death.

  • http://www.dirkstrauss.com Dirk Strauss

    Hey, awesome post! What about sqlite-net?

  • http://www.facebook.com/profile.php?id=572644060 Simon Jackson

    I’d also like to recommend AdRotator. It’s a fantastic package for WindowsPhone and Windows 8 for easily integrating multiple ad providers in to a single component without the hasstle of having to handle pesky ad failures.
    Plus you can put your own ad in it as well.
    http://wp7adrotator.codeplex.com

  • Pingback: The Daily Six Pack: April 18, 2013 | Dirk Strauss