Project Description

The MVVM Light Toolkit is a set of components helping people to get started in the Model - View - ViewModel pattern in all XAML/C# frameworks.

Get started

More information about the MVVM Light Toolkit can be found on http://www.galasoft.ch/mvvm.

Get more info about MVVM

  • Understanding the MVVM Pattern (MIX10 session)
http://www.galasoft.ch/mvvmvideo1
  • Deep Dive MVVM (MIX11 session)
http://www.galasoft.ch/mvvmvideo2

Donate

If you are so enclined, you can donate to MVVM Light Toolkit.
Or, if you prefer, you can pay me a beer next time we're in the same vicinity. Really, it is OK too :)

Latest news:

The latest news about MVVM Light are available from the MVVM feed on my blog at http://blog.galasoft.ch/category/10201.aspx.
(RSS feed).

 MVVM News Feed 
Sunday, March 10, 2013  |  From MVVM

Originally posted on: http://blog.galasoft.ch/archive/2013/03/10/session-material-from-techdays-be-and-nl.aspx

I had the chance to be invited again to speak at TechDays in Belgium (Antwerp) and in the Netherlands (The Hague), and delivered 3 sessions (one of them twice) to an audience of developers. It was as usual a very wonderful experience in two very well organized events. I also had the chance to speak to a number of great speakers such as Jeff Prosise, Ben Riga, Beth Massi, Iris Classon, Rich Griffin and many more who, in the past years spent travelling and speaking at various events around the world, have become really good friends. Meeting these old friends and talking to a lot of new people at conferences is really enriching and brings me a lot of joy. That is the real value of community in what we do, discovering new technologies together and sharing that knowledge.

Here is the material I used in my sessions.

Putting the Microsoft Design Language to work

Last year I started presenting a design session about what was then called the Metro design language. This year, I evolved the talk to include many practical examples of existing Windows Phone and Windows 8 apps, as well as many practical tips and tricks that our many years of experience developing with the Microsoft design language have taught us.

Abstract:

The new Microsoft Design Language (formerly known as Metro) has taken the tech world by surprise. It brings a refreshing change from hyper realistic design, and offers a welcomed alternative to the other mobile platforms. From Zune and then Windows Phone, the Microsoft Design Language is now used on a number of platforms and devices, notably on Windows 8 apps. In this session, we will see how we can practically convert the five design principles and put them to work, by studying real life applications and understanding how they were applied.

Video of the talk: Please come back in a few days when the video will be published.

Slides: http://sdrv.ms/ZBIU9r

The videos I showed to illustrate motion design and kinetic typography:

Source code:

  • AllAppBarButtons: A small Win8 app I put together to make it easy to view and use the Windows 8 application bar buttons. Remember that in order to use the buttons from the Common/StandardStyles.xaml resource dictionary, you need to uncomment the corresponding styles.
  • GridDemo: An example of how to use Blend to design the various states of the app: Portrait, Landscape, Snapped, Filled.
  • ShareContractDemo: An example of how to setup your app to be a share target for text and URI content.

Coding and designing for Windows 8 and Windows Phone

Sharing code is easier than ever with the usage of Portable Class Libraries (PCL). This technology is still quite new and a bit immature but we are moving fast! In this session, I show how to setup two apps (Windows Phone and Windows 8) with PCL, how to use Nuget to pull libraries, how to share code at source level too, and how to use NFC to send items from one device to the other.

Abstract:

With the release of Windows 8 and Windows Phone 8, Microsoft is reaching a new level of compatibility between desktops, laptops, tablets and mobile phones. This compatibility is not only at code level, but also visually, with the usage of the Microsoft design language. In this session, we will talk about best practices to share and reuse code and about UI design considerations in order to create the best possible experience for the user.

Slides: http://sdrv.ms/XAGmKY

Source code:

  • FriendsService: The web service I use to deliver the JSON list of Friends.
  • Friends: A Windows Phone and Windows 8 app connecting to the FriendsService to load a list of friends. The apps are setup for design time data (open in Blend to see it), MVVM (with MVVM Light), JSON.NET, the new HttpClient library, and NFC to connect the Windows Phone to the Windows 8 device.
  • AsyncWebClient: An example of how to create an asynchronous web client that can be used with async/await in Windows Phone, and consume it with the same async/await syntax in Windows 8 and in Windows Phone.

Advanced Windows Phone 8 development

Abstract:

Windows Phone 8 is the next big thing, and the press is already raving about new devices. With new capabilities, new sensors and improved performance, Windows Phone users have devices which are the best on the market. In this code-packed session, we will talk about advanced features such as asynchronous programming, web connections, mapping and location, background operations (multitasking) and other exciting topics.

Slides: http://sdrv.ms/XAHheu

Source code:

  • PhoneDemo: The full demo with Nuget, JSON.NET, MVVM (with MVVM Light), design time data (for Blend), NFC, Speech, Background Task, Toast notification, Live tile, Mapping and Location.
  • SimpleBackgroundTask: A simple app showing how to setup a background task, using toast and live tile for notification.
  • SimpleNfc: A simple app showing how to use NFC to exchange data between a Windows Phone and a Windows 8 device.
  • SimpleSpeech: A simple app showing how to make your phone speak, and how to make it react to voice commands.

Hoping that all this material will be useful to many developers out there!!

Happy coding,
Laurent

Thursday, February 14, 2013  |  From MVVM

Originally posted on: http://blog.galasoft.ch/archive/2013/02/14/mvvm-light-v4.1.27.0-in-nuget.aspx

I just pushed a new version of MVVM Light to Nuget. The new version is 4.1.27.0. The difference towards the previous version (4.1.26.1) and this one is that I am not depending on the CommonServiceLocator Nuget package instead of providing my own.

However, the CommonServiceLocator does not exist for all MVVM Light-supported frameworks. We have the following situation:

  • WPF3.5 SP1, WPF4, WPF4.5: Depends on the CommonServiceLocator Nuget package.
  • Silverlight 4, Silverlight 5: Depends on the CommonServiceLocator Nuget package.
  • Windows Phone 7.1, Windows Phone 8: Provides its own CommonServiceLocator implementation
  • Windows 8: Provides its own CommonServiceLocator implementation
  • Windows Phone 7.0, Silverlight 3: Not supported anymore in Nuget.

This change was needed for two reasons:

  • Simplifying the deployment by relying on existing packages instead of using my own.
  • Avoiding strong name issues when working in conjunction with another package that uses the CommonServiceLocator (such as Unity for example).

MVVM Light (full) now depends on MVVM Light Libs

There are two packages in Nuget for MVVM Light:

  • MvvmLightLibs provides only the DLLs with the toolkit’s components. No additional content is added.
  • MvvmLight provides the DLLs and also a skeleton of ViewModelLocator and MainViewModel (as files). It also modifies the App.xaml and MainPage.xaml file to (attempt to) wire the ViewModelLocator and the MainViewModel (as DataContext). There are still a couple of issues in Windows 8 and Windows Phone 8 which I will do my best to solve ASAP.

What’s next? Installer!

The next step will be to finally provide the full MSI with the 4.1.27 build of the DLLs as well as some changes to the project templates. I had a few issues with the installer but I have good hopes that I can resolve that soon.

Happy coding
Laurent

Saturday, January 05, 2013  |  From MVVM

Originally posted on: http://blog.galasoft.ch/archive/2013/01/05/mvvm-light-v4.1.26-change-log.aspx

I just published the change log for MVVM Light V4.1.26, which is available on Nuget only at this time. The full version is available here, while the “libraries only” version is available here.

I am working on an installer which will also add a few more changes to the templates and one bug fix in the code snippets. Stay tuned for that installer as soon as I figure a few things out.

Important note: V4.1.26 is only available on Nuget (here and here) at the current time. An installer will be published soon with changes to the project and item templates too.

Miscellaneous

  • BL0023.003, Change source structure to include Windows 8 in the normal flow of the folders
  • BL0023.004, Remove UniversalConverter
  • BL0023.005, Issue 7594: VS 2012 XML Design time error
  • BL0023.007, Remove INPChanging temporarily to solve design time issues (WP7.1 only)
  • BL0009.006, Ported to .NET 4.5
  • BL0009.007, Ported to Windows Phone 8

SimpleIoc

  • BL0005.001, Issue 7577: SimpleIoc misleading error when class has private constructor
  • BL0005.003, An exception can occur when a class has a static constructor and a default constructor, even when they are not explicitly declared.
  • BL0005.007, ContainsCreated should return true if called without a key, if a keyed instance is found

EventToCommand

  • BL0004.005, The type 'EventToCommand' from assembly 'GalaSoft.MvvmLight.Extras.WPF4' is built with an older version of the Blend SDK, and is not supported in a Windows Presentation Framework 4 project.

DispatcherHelper

  • BL0004.001, Rename InvokeAsync in RunAsync
  • BL0004.002, Return DispatcherOperation (or IAsyncOperation in Win8) for RunAsync.

Happy coding

Laurent

Sunday, November 11, 2012  |  From MVVM

Originally posted on: http://blog.galasoft.ch/archive/2012/11/11/a-fix-for-the-design-time-error-in-mvvm-light.aspx

For those of you who installed V4.1 of MVVM Light and created a project for Windows Phone 8, you will have noticed an error showing up in the design surface (either in Visual Studio designer, or in Expression Blend). The error says: “Could not load type ‘System.ComponentModel.INotifyPropertyChanging’ from assembly ‘mscorlib.extensions’” with additional information about version numbers.

The error is caused by an incompatibility between versions of System.Windows.Interactivity. Because this assembly is strongly named, any version incompatibility is causing the kind of error shown here (for an interesting discussion on the strong naming issue, see this thread on Codeplex).

I managed to resolve the issue for Windows Phone 8 and will publish a cleaned up installer next week. In the mean time, in order to allow you to continue development, please follow the steps:

  • Download the new DLLs zip package (MVVMLight_V4_1_26.zip). 
  • Right click on the Zip file and select Properties from the context menu.
  • Press the “Unblock” button (if available) and then OK.
  • Right click again on the zip package and select “Extract all…”. Select a known location for the new DLLs.
  • Open the MVVM Light project with the design time error in Visual Studio 2012.
  • Open the References folder in the Solution Explorer.
  • Select the following DLLs: GalaSoft.MvvmLight.dll, GalaSoft.MvvmLight.Extras.dll, Microsoft.Practices.ServiceLocation.dll and System.Windows.Interactivity.dll.

  • Press “delete” and confirm to remove the DLLs from your project.
  • Right click on References and select Add Reference from the context menu.

  • Browse to the folder with the new DLLs.
  • Select the four new DLLs and press OK.
  • Rebuild your application, and open it again in Blend or in the Visual Studio designer.

The error should be gone now.

In the next few days, as time allows, I will publish a new MSI containing a fixed version of the DLLs as well as a few other improvements. This quick fix should however allow you to continue working on your Windows Phone 8 projects in design mode too.

Special note for WP7.1

Because of some issues with the WP7.1 version of the DLLs, I had to (hopefully temporarily) remove the INotifyPropertyChanging interface from the ObservableObject and ViewModelBase classes. I am talking with Microsoft to try and solve this issue. In the meantime, I hope that this change will not affect too many people.

 

Sunday, November 11, 2012  |  From MVVM

Originally posted on: http://blog.galasoft.ch/archive/2012/11/11/oredev-2012-summary-and-source-code.aspx

This week, I had the pleasure to be invited to talk at Oredev, a really cool conference taking place in Malmo, Sweden. The whole event is awesome, including a very special dinner on Monday including sauna and swimming in a 6 degrees cold Baltic sea, and a reception with dinner at the town hall, including the mayor himself. Considering Malmo is a town of 300'000 inhabitants, it is a pretty nice occasion and the historical building itself is really worth seeing. For those interested, I placed my pictures on my Flickr account.

I had a workshop on Tuesday morning about Windows 8 development with XAML/C#, and then a session on Wednesday about MVVM in Windows Phone 8 and Windows 8, of course using MVVM Light. I was very nervous because I reworked some of my demos as recently as this morning, in the wake of the Build conference last week and the release of both the Windows Phone SDK and MVVM Light V4.1. Everything went well however, and if I judge by the people I talked t after the talk, and Twitter, everything went pretty well.

Before my talk on Tuesday, I had the pleasure to see a talk by Iris Classon (@irisclasson) on the challenges of being a "n00b" and a woman in software development. I especially appreciated her research and conclusions on the lack of women I our industry, a topic that is dear to my heart (because I want the best possible future for my two daughters, and also because I really enjoy working with women on projects, and getting a different insight on the art of software development.

I really want to thank the excellent organization committee for their hard work and their fantastic welcome to Malmo. In particular Emily Holweck did a wonderful job and was super helpful throughout the preparation and the conference itself. I made a few pictures during my stay, all with the new Nokia Lumia 920, and hope you will enjoy them too.

The source code and the slides…

The source code is available for download from Skydrive. You will find the following:

  • Windows 8 workshop slides.
  • MVVM Applied slides
  • Source code package with
    • Win8Demo: The demo I built during the 4 hours workshop, with some light MVVM, web services (JSON), GridView, Design time data (Blend / Visual Studio designer), Bing maps integration, location sensor, Search pane integration.
    • SemanticZoomSample: a sample I put together to demonstrate the SemanticZoom control, with two GridViews and of course full design time data for Blend work. Due to time constraints, I was not able to show this demo during the workshop, but I publish it anyway, hoping it will be useful to someone.
    • PictureUploader: The demo I built during my 50 minutes session about MVVM Applied in Windows Phone 8 and Windows 8. Code sharing, design time data, MVVM Light are used in Windows Phone 8 and Windows 8 apps.

And in video…

You can also see the video of my MVVM talk thanks to the good services of the Oredev team!

MVVM Applied in Windows Phone and Windows 8 from Øredev Conference on Vimeo.

 

Tuesday, October 30, 2012  |  From MVVM

Originally posted on: http://blog.galasoft.ch/archive/2012/10/30/mvvm-light-v4.1-with-support-for-windows-phone-8.aspx

Today is a very exciting day: After the official release of Windows 8 (and Microsoft Surface!) on Friday, and the official release of Windows Phone 8 on Monday, the Build conference is starting! This is the conference in which we will learn all about the developer experience for Windows 8 and Windows Phone 8.

As a partner of Microsoft, I had the privilege of trying out some of the new things early, and this gave me the opportunity to port MVVM Light to Windows Phone 8 (it was already running for Windows 8), and today I am officially publishing this new version.

Before you go and update, please not the following: V4.1 (4.1.24.0) only supports Visual Studio 2012 (and Express). If for some reason you are still using Visual Studio 2010, don’t despair! In the next few days I will publish an update supporting these versions as well. But for now, please only upgrade if you are on VS12!

That being said, here we go: The download page is available on Codeplex and you can download the updated MSI and install it. Please make sure to read the Readme HTML page that automatically opens in your web browser after the MSI completes! It contains important information on how to install selected Project and Item templates for the frameworks of your choice.

This version also support the following versions of Visual Studio:

We also support Expression Blend of course.

Windows Phone 8 and Windows 8 are very very exciting opportunities for developers in the whole world. There are already a number of apps running on top of MVVM Light in the Windows Store and of course a large range of apps for Windows Phone too. With this release, we hope to support the developers and speed up application development. It is a pleasure to serve such an innovative and creative community!

Happy coding
Laurent

 

Wednesday, October 10, 2012  |  From MVVM

Originally posted on: http://blog.galasoft.ch/archive/2012/10/10/ldquousing-the-mvvm-pattern-in-windows-8rdquo-in-msdn-magazine.aspx

These days I am swimming in Windows 8 code, and I must say it is a good feeling. This gives me the occasion to push MVVM Light and a few other components of mine to their limits, and to fix or improve a few things on the fly. All this goodness will be available in V4.1 which is scheduled shortly after Windows 8 launch.

In spite of the busy schedule, I couldn’t resist writing an article for MSDN magazine about, you guessed it, the MVVM pattern and MVVM Light in Windows 8. It is an article that goes quite in depth in some of the concepts, and provides an app demonstrating how to use them.

The article is available for free in the special Windows 8 edition of MSDN magazine that just came out today. Enjoy!

 

 

 

Monday, September 10, 2012  |  From MVVM

Originally posted on: http://blog.galasoft.ch/archive/2012/09/10/adventures-in-windows-8-solving-activation-errors.aspx

Note: I tagged this article with “MVVM” because I got a few support requests for MVVM Light regarding this exact issue. In fact it is a Windows 8 issue and has nothing to do with MVVM Light per se…

Sometimes when you work on a Windows 8 app, you will get a very annoying issue when starting the app. In that case, the app doesn’t not even start past the Splash screen. Putting a breakpoint in App.xaml.cs doesn’t help because the app doesn’t even reach that point!

So what exactly is happening? Well when a Windows 8 app starts, the system is performing a few check first. One of the checks, for instance, is to see if an app with the same package ID is already available. The package ID is a unique value set in the package manifest.

  • In the Solution Explorer, double click on Package.appxmanifest.
  • This opens the manifest in a special editor
  • Click on the Packaging tab
  • See the GUID under Package Name. This is the unique ID I am talking about.
Package manifest

If there is a conflict (i.e. if an app is already installed with the exact same ID), Windows will warm the user that the app is already installed. However when you are in the process of developing an app, you install and uninstall the same app many many times (every time that you start in Visual Studio), and sometimes some issues arise, for instance failing to uninstall the app before starting the new instance of the same app.

First step if you get such an error

When the application fails to start past the splash screen, the first step is to identify what kind of error happened. In my experience the “already installed” is by far the most frequent (in fact I never had another such error), but it can be something else. An annoying thing is that the popup that shows the error is usually started below the Windows 8 app, and so you don’t even see it! This is especially true if you run this in the Simulator. In that case, do the following: Press on the Simulator’s home button, then press on the Desktop tile on the Start menu. The error popup should be shown on the desktop.

If your applications runs on the Local machine, you also do the same and press the Windows button, and then from the Start menu press the Desktop tile.

Deployment error in Studio

Sometimes the same error causes Visual Studio to fail launching the application at all with a deployment error. This is a better case, because at least it is clear that there is an issue. In that case, write down the code that is shown in the Error window (for instance 0x80073D05 in the example below).

Deployment error

Once you have the error code, go to the “Troubleshooting packaging, deployment, and query of Windows Store apps” page and look up the code in question.

In my case, the error was “ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED”, “An error occurred while deleting the package's previously existing application data.”

Solving the “ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED” issue

Update: Before trying the below, you can also try the simple steps:

  • Exit Visual Studio
  • Go to the Start menu
  • Locate your app’s tile. It should be visible in the Start menu directly, towards the far end on the right.
  • Right click the tile and select Uninstall from the App Bar.
  • Restart Visual Studio and try again.

Sometimes it helps. If it doesn’t, then try the following:

In order to solve the case where Windows, for any reason, fails to delete the existing application before starting the new instance, follow the steps:

  • Open the Package.appxmanifest in Visual Studio
  • Open the Packaging tab.
  • Change the Package name. For tests you can just try to change the last character of the GUID, though I would recommend creating a brand new GUID.
    • Press Start
    • Type GUID
    • Start the GUID Generator application
    • Select Registry Format
    • Press Copy.
    • Paste the new GUID in place of the Package Name in Visual Studio
    • Important: don’t forget to remove the curly brackets at the beginning and at the end of the newly pasted GUID.

Then you just have to cross your fingers and start the application again… If it works, celebrate. if it doesn’t work… well at this point I am not sure so good luck with that ;)

Happy coding,
Laurent

 

 MVVM News Feed 

Last edited Oct 23, 2011 at 2:53 PM by lbugnion, version 16