877 people following this project (follow)

Project Description

The MVVM Light Toolkit is a set of components helping people to get started in the Model - View - ViewModel pattern in Silverlight and WPF. It is a light and pragmatic framework that contains only the essential components needed.

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, April 29, 2012  |  From MVVM

That is a symbolic milestone: Last week, MVVM Light reached the bar of 120’000 downloads on http://mvvmlight.codeplex.com, the site that has been hosting source and installers since the beginning of the project (100'000 downloads) and on Nuget, the popular package manager for .NET (20'000 downloads). More information about Nuget and MVVM Light.

Celebration

Scroll down to have a chance to win a copy of
Expression Studio V4!

2012042203

 

MVVM Light started its “career” on Codeplex in October 2009. Back then it was intended as a set of classes I could use when blogging about MVVM, to avoid having to repeat the same concepts over and over again. These ideas were born from discussions on the WPF disciples mailing list (now renamed to “XAML disciples”), a group of friends who talks about everything and anything and occasionally about coding. In fact in some cases some code was even stolen borrowed with appreciation from some of the individuals on this list. Since then of course, the code has evolved, driven by requests from the community. I have a lot of appreciation for everyone who helps, and for the many interesting discussions around MVVM and other coding concepts.

I remember one discussion (in a sauna in Seattle, of all places) with my friend Josh Smith about what I wanted to achieve with MVVM Light. Back then I told him that my goal was to have this side project, but that I didn’t intend to let it grow too big. I can say with confidence that I failed big time: MVVM Light is taking a lot of my free time, but what a reward!

Multiple platforms

MVVM Light is available these days for Silverlight 3, Silverlight 4, Silverlight 5, WPF3.5, WPF4, Windows Phone, WinRT (Windows 8). I know for a fact that it is running into many Windows Phone applications (MVVM Light for WP7 was released within a few days from every major version of Windows Phone).

Lesser known fact, MVVM Light is also running on XBOX: At the end of last year, a lot of new applications were released for this platform. The applications are XAML based, and MVVM Light was chosen as the framework of choice to build these applications. There is no obligation, but this is driving adoption of MVVM Light in the living room!

Of course Windows 8 is also supported. Here too, MVVM Light was available within a few days from the major releases (developer preview, customer preview) and that will continue. I have the chance to have people within Microsoft who are using MVVM Light and helping me with issues, again it is a great pleasure to have this collaboration.

An amazing community

If like me you follow the #mvvmlight tag on Twitter, you will see that many people worldwide are using it. I love to see tweets about it in all kinds of languages (in fact if I would love to travel to all the places where it is used :)

I also receive many more emails than I can handle. I really do my best to answer everything, sometimes with a delay, but I fail. If you have sent me an email and it was not answered, please accept my sincere apologies. It’s simply too much to handle. On the other hand, if you have technical questions, make sure to post the on StackOverflow with the tag "mvvm-light"!! Questions there are rarely left unanswered, and I am also checking them out from time to time. Crowdsourcing the tech support has probably been one of the best decisions I ever made in this project!

Things I would like to do (or to have done differently)

Not everything is perfect in this project, by far. There are a few things I really would like to do better, and some thing I would like to have done differently.

First, the documentation: This is an oft-heard comment and it is true, there isn’t a structure documentation concept. There are however many many articles by MVVM Light enthusiasts, but I agree that for a beginner it can be a daunting task to find their way through all the information. So yes, this is still a big project and a big plan, I want to have a solid documentation concept. When? Well that is the big question, because that takes a lot of time. The balance between coding and documenting is really not easy. That said, the whole source code is documented, so at least that is clean :)

Another thing I regret is that I took over too many new features and bug fixes in V4. Because of that the gap between V3 and V4 was much too long. I will change that in the next version, and release true RTM versions more often.

V4 and then?

These days I was busy releasing V4 release candidate (RC) to Codeplex (source), Nuget and to create an MSI installer. I will give a couple of weeks to the RC just to catch last minutes bugs (if available) and make a few minor adjustments. It means that V4 will definitely be released in the next few weeks.

And then… well then I want to tackle a few things: more documentation, and starting to work on V5. I also have a couple of applications for the phone and for Windows 8 that I would love to finalize. I guess that rest is for the dead, eh? ;)

Again, I want to thank everyone who sends me messages of support through the years. I could not have done all this without the moral help of the community.

Celebration

To celebrate this milestone, I am giving away two copies of Expression Studio 4 Ultimate (includes Expression Blend, Sketchflow, Expression Design, Expression Encoder Pro and Expression Web+Superpreview). This is a value of 599 USD each!

2012042203

Not only you will have a chance to win this for as little as 10 USD, but in addition the whole proceeds of this auction will be sent to the humanitarian organization Calcutta Rescue. I have many ties with this organization and I was even president of the Swiss organization (in charge of gathering funds in Switzerland) for quite a few years. In 2007, I had the chance to visit the projects personally and I can attest that they are extremely well managed. You can see pictures of this visit on my Flickr page.

In order to participate, follow the easy step:

On May 29th, I will block the counters and will randomly pick two winners for the Expression Studio copies. Winners will be notified per email and the prizes sent by standard mail. I will personally ensure that the funds are sent to Calcutta Rescue by the intermediary of the Swiss organization Calcutta Espoir, whose sole purpose is to gather funds in Switzerland for the Indian NGO.

I count on you, awesome MVVM Light community, to make this action a success! See you on May 29th to announce the winners!

Cheers
Laurent

 

Tuesday, April 24, 2012  |  From MVVM

Well I'll be… I stand corrected!

I recently published a blog post stating that you need to declare a command as ICommand (instead of RelayCommand) if you want it to work in Windows 8. I even went as far as to modify the MVVM Light code snippets that are used to create commands.

In fact, scratch that post… I was wrong! I got a few people writing to me and letting me know that RelayCommand works just fine for them. And now, after I tested again, I cannot reproduce the issue! So I need to be clear, my first post was wrong, and I stand corrected.

Based on the feedback, I will also set the MVVM Light snippet back to expose the command as RelayCommand instead of ICommand. It would indeed be "purer" as ICommand, but it also causes issues (such as the need to cast to call RaiseCanExecuteChanged) and is not worth it.

Sorry about the confusion folks!!

Cheers,
Laurent

 

Sunday, April 22, 2012  |  From MVVM

I just published the MVVM Light V4 RC packages to Nuget. Note that this is still technically a preview, so the main package is still V3. The V4 packages are available here:

  • Package with libraries and content:
    When you install this package into a “virgin” application (i.e. an application without ViewModelLocator, preferably a brand new application), it installs a new ViewModel folder with a MainViewModel, ViewModelLocator and adds an entry into the App.xaml file to intialize a the ViewModelLocator in the global resources.
    Do not use this package if you want only the libraries, this will add content files!
  • Package with libraries only:
    This installs and references only the libraries.

Both packages are available for Silverlight 3, Silverlight 4, Silverlight 5, .NET3.5SP1, .NET4, Windows Phone 7.0, Windows Phone 7.1 and Windows 8 (WinRT). That last one is brand new! :)

Nuget prerequisites

Follow the steps to install Nuget (if needed):

  • In Visual Studio 10 or 11, select the menu Tools, Extension Manager.
  • In the Extension manager, select Online Extensions, Visual Studio Gallery.
  • In the field marked “Search Installed Extensions:, enter “nuget”.
  • Select the Nuget entry and then press Install.
  • Restart Visual Studio.

Installing from VS directly

In Visual Studio, follow these steps to install the packages:

  • Open an application without MVVM Light installed.
  • Right click on the project and select Manage Nuget Packages.
2012042201
  • In the Manage Nuget Packages dialog, select Online (on the left).
  • Enter “mvvmlight” in the Search Online field.
  • You will see four choices:
    • MVVM Light: This is the stable release (V3RTM) with content files. Not available for Windows 8!
    • MVVM Light libraries only: This is the stable release (V3RTM), only libraries. Not available for Windows 8!
    • MVVM Light [Preview]: This is V4RC with content files.
    • MVVM Light libraries only [Preview]: This is V4RC, only libraries.
  • Select the package you want to install and press Install.
2012042202

That’s it.

Updating from VS directly

If you have a previous version already installed, you can look for the update with the following steps:

  • Right click on the project and select Manage Nuget Packages.
  • In the Manage Nuget Packages dialog, click on Updates.
  • If an update for the given package is available, you can install it from there,

As usual, please try it out and let me know if something does not work right!

Happy coding
Laurent

 

Friday, April 20, 2012  |  From MVVM

I stumbled upon an interesting issue in Windows 8 Consumer Preview: When you declare a command and try to bind to it, the command will only be invoked if the property is declared as ICommand. If you declare it with the class that implements ICommand (for example RelayCommand for MVVM Light), the command will never be executed. This is not discoverable at all, because the command execution fails silently, without any hint of what happened.

So to clear up… If you have this binding in Windows 8:

<Button Content="Test the command"
Command="{Binding MyCommand}" />


This fails:



public RelayCommand MyCommand
{
get;
private set;
}


This works:



public ICommand MyCommand
{
get;
private set;
}

Modifying the snippets



In consequence, I decided to modify the MVVM Light code snippets accordingly. From V4 RC (which is the version currently in Codeplex, and for which an installer will be released in the next few days), all code snippets declaring a RelayCommand are modified as follows:



Before modification (pre-RC):



private RelayCommand _myCommand;

/// <summary>
/// Gets the MyCommand.
/// </summary>
public RelayCommand MyCommand
{
get
{
return _myCommand
?? (_myCommand = new RelayCommand(
() =>
{

}));
}
}


After modification (RC):



private ICommand _myCommand;

/// <summary>
/// Gets the MyCommand.
/// </summary>
public ICommand MyCommand
{
get
{
return _myCommand
?? (_myCommand = new RelayCommand(
() =>
{

}));
}
}


Note that even though this is only an issue in Windows 8, I modified the snippets for all supported platforms. Actually having the RelayCommand declared as an ICommand makes sense, from a purity point of view.



I hope that this post will help people deal with an issue that is not very discoverable…



Happy coding,

Laurent



 



Tuesday, April 17, 2012  |  From MVVM

I had the chance to be invited to talk at various conferences this year already, and I promised to post the slides and source code, so here it is!

MVVM Applied: From Silverlight to Windows Phone to Windows 8

Belgium, Netherlands, Bulgaria

The Model-View-View Model pattern is a common denominator between applications using XAML to create the user interface. First applied in WPF, it was then easily ported to Silverlight and Windows Phone development. With WinRT and the Metro-style applications, XAML is now a first-class citizen for native Windows 8 development. Here too, the MVVM pattern is making developers' life easier, and proven components can be used to simplify and speed up application development. In this session, Laurent Bugnion, the creator of the acclaimed MVVM Light Toolkit, will present best practices around XAML-based Windows 8 application development, and how to leverage code and skills in Windows 8 too.

100% Fidelity: From Comps to Apps, Tips and Tricks for XAML Integration

Netherlands

Designers create a vision, and this vision becomes an application. With some technologies, the transition from the vision to the UI can be a painful and frustrating exercise. With XAML however, we have tools and techniques that make this transition much easier and allow for 100% fidelity to the comps. In this session, Laurent Bugnion (Director of UX Integration, IdentityMine) will show tips and tricks gathered over 6 years of experience. We will talk about design time data, exporting assets from Adobe design applications, measuring and adapting, animations... Together we will learn techniques that apply to multiple platforms, from Silverlight to Windows Phone 7 to WinRT, WPF, Microsoft Surface, Kinect and more.

Metro Design Principles

Switzerland (Tech Conference), Switzerland (Shape), Bulgaria, Dubai

The Metro design language is becoming an intrinsic part of the Microsoft user experience. Already, we can find it on Zune (where it all started), Windows Phone 7 (where it was refined and perfected), Xbox, Windows 8, as well as on the Microsoft.com website. In this session, we will dive into the history of this design language, study its characteristics and show tips and tricks to implement Metro user interfaces in Windows Phone and Windows 8.

Building The Apps of the Future on Windows 8!

Dubai

The future of application development is here! Attend this session to get a comprehensive view of app development on Microsoft's latest client platform - Windows 8!

Going mobile with Windows Phone

Dubai

This session is intended to introduce developers to Windows Phone. It isn’t your boring old level 100 intro session. This session assumes that you know how to develop applications and skips past the "hello world" stuff to talk about tools, navigation elements, the back stack, phone controls and the marketplace.

 

Video: MVVM Applied: From Silverlight to Windows Phone to Windows 8

 

Video: 100% fidelity: from comps to appl, tips and tricks for XAML integration

 

Friday, April 06, 2012  |  From MVVM

If you installed the latest MVVM Light version for Windows 8, you may encounter an issue where code snippets are not displayed correctly in the Intellisense popup. I am working on a fix, but for now here is how you can solve the issue manually.

The code snippets

MVVM Light, when installed correctly, will install a set of code snippets that are very useful to allow you to type less code. As I use to say, code is where bugs are, so you want to type as little of that as possible ;) With code snippets, you can easily auto-insert segments of code and easily replace the keywords where needed. For instance, every coder who uses MVVM as his favorite UI pattern for XAML based development is used to the INotifyPropertyChanged implementation, and how boring it can be to type these “observable properties”. Obviously a good fix would be something like an “Observable” attribute, but that is not supported in the language or the framework for the moment. Another fix involves “IL weaving”, which is a post-build operation modifying the generate IL code and inserting the “RaisePropertyChanged” instruction. I admire the invention of those who developed that, but it feels a bit too much like magic to me. I prefer more “down to earth” solutions, and thus I use the code snippets.

Fixing the issue

Normally, you should see the code snippets in Intellisense when you position your cursor in a C# file and type mvvm. All MVVM Light snippets start with these 4 letters.

mvvm snippets in Intellisense
Normal MVVM Light code snippets

However, in Windows 8 CP, there is an issue that prevents them to appear correctly, so you won’t see them in the Intellisense windows. To restore that, follow the steps:

  • In Visual Studio 11, open the menu Tools, Code Snippets Manager.
  • In the combobox, select Visual C#. Code Snippets Manager
  • Press Add…
  • Navigate to C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\SnippetsWin8 and select the CSharp folder.
  • Press Select Folder.
  • Press OK to close the Code Snippets Manager.

Now if you type mvvm in a C# file, you should see the snippets in your Intellisense window.

Cheers
Laurent

 

Sunday, April 01, 2012  |  From MVVM

MVVM_Original_195x100

I just pushed the following to Codeplex:

  • A new MVVM Light project template for Windows 8 Consumer Preview. This template appears in the File, New Project dialog and allows you to create a Metro style app already wired with MVVM Light.
  • An updated Windows 8 installer for MVVM Light.

Preconditions:

This installs MVVM Light for Windows 8 only. You can install it side-by-side with the standard MVVM Light for Silverlight, WPF and Windows Phone.

Where do I get it?

You can download the MSI from:
http://mvvmlight.codeplex.com/releases/view/85317

What does it do?

The installer installs the Windows 8 version of the MVVM Light DLLs, as well as a new project template for an MVVM Light Metro style app, and code snippets.

What is missing?

Since Windows 8 Developer Preview, I worked on porting the DispatcherHelper class, and it works now. However the EventToCommand behavior is still not available on Windows 8 (because behaviors are not supported on Windows 8 for the moment).

Known issues

Some testers reported issues with the code snippets installation. Code snippets should appear when you type “mvvm” in your C# code, there is a list of mvvm-prefixed snippets (such as mvvminpc, etc). If you do not see these snippets, please stay tuned, I am working on fixing this issue.

 

Sunday, February 19, 2012  |  From MVVM

This week I was “on tour” in Belgium and Netherlands and presented 3 times:

“MVVM Applied, From Silverlight to Windows Phone to Windows 8”

(in Belgium and Netherlands)

The goal of this session was to make people feel confident that the skills they acquired working in various XAML frameworks (Silverlight, Windows Phone, WPF, Surface, etc) are going to help them tremendously when developing Windows 8 applications. It was a session packed with code, where we went from a Silverlight 5 application, added design time experience, reworked the design in Expression Blend, then created an application reusing most of the code in Windows Phone (including design time experience in Blend), and then created a WinRT application which, again, reused most of the code (including design time experience in the Visual Studio Designer). Of course the sample code uses the MVVM Light Toolkit in order to make the coding easier, and to maximize code reuse.

I also showed techniques to keep as much compatible code as possible between the frameworks, and abstract the differences. For instance, Windows 8 is more asynchronous than Silverlight (which was already more asynchronous than WPF, remember the discussions around the lack of synchronous web requests in Silverlight?). In Windows 8, operations such as file system access and stream access (read/write) are asynchronous now. Using techniques such as callbacks, you can quite easily isolate the code that is Windows 8-specific, and call into it from shared code (more about this technique in a following blog post). It was an interesting session that gathered quite a lot of positive feedback.

You can download the following from Skydrive:

  • Start solution (PictureUploader-0-Start, running Silverlight 5 application, without design time data)
  • Silverlight 5 (PictureUploader-1-SL5) design time data complete
  • Windows Phone 7 (PictureUploader-2-WP7) application complete
  • Windows 8 (PictureUploader-3-Win8) application complete
  • Code snippets for VS10 (Snippets.vssettings, Silverlight 5 and Windows Phone)
  • Code snippets for VS11 (SnippetsWin8.vssetings, Windows 8)
  • Slides (MVVMApplied)

To import the code snippets in Visual Studio’s toolbox, select the menu Tools, Import and Export Settings, and select the snippets file. This will import the snippets into your toolbox. Note that if you had snippets in your toolbox before, it will add the new ones instead of overwriting the old ones.

Note about the Windows 8 sample: For some reason the sample refuses to start if you include the GalaSoft.MvvmLight.Extras DLL for Windows 8. It does however run just fine if you include the project instead. For that reason, I included a copy of that project’s source code and referenced it directly. Given the current state of Windows RT (developer preview), I won’t even waste any time looking for a fix. We’ll see about that in the Consumer preview ;)

“100 Fidelity: From comps to apps, tips and tricks for XAML integration”

(in Netherlands only)

The purpose of this session was to show the audience usage of various tools (of course mainly Expression Blend) to create user experience that is as close from the designers’ vision as possible. Nowadays with XAML and Blend, it is possible to reach 100% fidelity. I also talked about the integrator role, a role that we fully embrace at IdentityMine. The integrator’s main tool is Blend, and Blend is used to integrate the design assets into the application. We talked about and demoed the features that make Blend truly shine, such a gradient creation, resource management, animations, etc.

Even though this session was in the graveyard shift (Friday afternoon, 4PM), I was positively surprised to see quite a few people attending. Also, when asked who in the audience is a designer, I saw approximately 10 hands raising, which is more than usual. Are we seeing more interest from designers in Blend due to Metro? One can only wish so!

You can download the following from Skydrive:

  • Slides (100%Fidelity)

There is no source code for this session, because most of the demos were about creating and integrating assets in Blend. Refer to the video for more details.

Videos will follow

For various reasons, there will be a delay before the videos are made available. Stay tuned to my Twitter account, and I will let you know when the videos are ready!

Screenshots

These screenshots are taken from the “MVVM Applied” session

2012021504

Silverlight 5 application with a beginning of styling

2012021505

Windows Phone application start screen

2012021507

Windows Phone application during upload

 2012021508

Windows Phone application, upload completed

 2012021501

Windows 8 application, start screen with application bar

2012021502

Windows 8 picture picker

2012021503

Windows 8 application during upload

A few impressions

WP_001358

The room where I presented MVVM Applied in Netherlands

WP_001359

The room where I presented MVVM Applied in Netherlands

WP_001360

They had my book (and Brennon’s) at the conference bookstore :) 

A cool clownfish

Cheers,
Laurent

 

 MVVM News Feed 

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