File size

File size

File size

File size

File size

928.6 MB

In 2010, the MIX session "Understanding the MVVM pattern" helped you to understand the basics of this very important pattern used in Silverlight, WPF and Windows Phone 7 applications. Building on this foundation, this year’s session will show you with a lot of code samples how to build complex interactive applications using proven best practices and powerful tools. Laurent Bugnion, a user and promoter of MVVM since the early days, author of “Silverlight 4 Unleashed” and of the acclaimed MVVM Light Toolkit, will help you to deep dive in MVVM and explore topics such as navigation, showing dialogs, collecting user feedback, handling multiple views and viewmodels, and more.

For more information, check out this course on Microsoft Virtual Academy:

Hey Laurent,Could u pls elaborate on best practive to link Mockup data services (data for Blend) and Real Data services with ViewModel.And how all this can work together in Prism application.May be you have new ideas besides ModelViewLocator...

Channel9 team:The MP4 encoding is not compatible with iOS devices. (Tried iPhone, iPad, iPod) Error: "Some of the videos in your iTunes library, including the video ... were not copied to the ... because they cannot be played on this ..."

Very good presentation. I really appreciate your work on the MVVM Light toolkit. I have several comments:

JSONDemo - I personally don't like the idea of forcing Friend to inherit ObservableObject. The friend class could already inherit something else already. It could also belong to some other project/library that I have no control. Also, they way FriendViewModel has Friend property kind of violate the Law of Demeter.In my opinion, I prefer having the FriendViewModel encapsulates all properties of Friend. That's what I did for my own projects.

DialogService / DialogControl - I think you might like to know that there is a Popup control.(http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup(v=vs.95).aspxMy IDialogService is actually a part of a utility library. There is a concrete implementation of IDialogService which uses a XAML control within the library. By using the Popup control, I don't have to add the DialogControl to every XAML page. I just inject IDialogService to my ViewModels and I'm set.

Just watching your session. I disagree that you can have Visibility and Brush types in a ViewModel. You want to have your ViewModel as abstract as possible so that you can use them 100% on another platform. iOS and Android are very popular now and the concept of Visibility or Brush may or may not transfer over to another platform.

You can use enums or bool or strings and use a IValueConverter to convert them for the View to use.

I'm developing a library for iOS ( and will have it ported to Android) called MonoMobile.MVVM with the goal that your existing ViewModels and Models should just need a recompile. Its the Views that need to be rewritten since the UI is different on every platform.

I was at the session and remember having the same thought, why having a Visibility value in the VM instead of a bool combined with a converter?But I am sure Laurent wanted his demo to be concise on that side (and converter are not new and not directly related to MVVM), he had so much stuff to show!Awesome session by the way.

Anyone used Prism for a bigger project? MVVM seems not to be enough as we have to modularize the application.As far as I have seen - getting up to speed with Prism is difficult. So much to learn...Unfortunately something like a region managment system (dockmanager) seems to be not so easy either.

@Vitaliy: Hi, My preferred way of creating design time or test time data is to use a data service (for example IFriendsService in the video) and to inject different implementation depending on the scenario (design, test, runtime)). As you will see in the video, I use an IOC container to inject the service in the ViewModel. This is not compulsory, you can also create the VMs in the ViewModelLocator. This is a clean way to connect to your data.

@ingamx: Hi and thanks! You should check MefedMVVM by Marlon Grech, he is using both MVVM (strongly inspired by MVVM Light) and MEF. I used MEF and MVVM Light in many projects, and I love it as a lightweight alternative to PRISM.

@HelloWorld: Thanks so much for the feedback. I appreciate that not everyone likes the same implementations, and it is fine. Let me explain why I chose this aproach:

- JSONDemo: I do realize that some people dislike it, and honestly it is fine if you prefer the alternative way you describe. I rather met people who prefer avoiding replicating the properties, but if that works for you, by all means, go for it. About the proxy, note that WCF created proxies do in fact implement INPC, so they follow the same kind of things I am showing here. Not saying it is better, just saying it is the same

Yes, if Friend inherits something, this does not work. In which case you can just implement INPC manually, which is not a huge deal.

- DialogService / DialogControl

Yes there is, however I wanted to show the example in WP7 where I saw a LOT of ugly MessageBoxes being used The custom control I demoed is one that I happened to use on some production applications myself, I thought it was cool. The point was that the showing of the dialog is the responsibility of the view, and that you can make one yourself, or use a popup, or...

My IDialogService, the IDialogControl and the PhonePageBase are also part of my WP7 library. The Custom Control is not, because I like to tweak it with colors and design, so I just have a project template for VS10 that has this control within. Here too, I just inject IDialogService, and voila.

@robertd: It is a compromise between small resolution (the projector was 1280x720 which is already wider than the usual 1024x768), 120% font size in Studio but not wanting to go higher in size otherwise I would have to scroll horizontally too much (which I already did in a few places, and I hate that). It is hard to find a good compromise. Hope it didn't spoil the video completely for you

@Robert Kozak: The reason why I do not like to use IValueConverter is that it is a performance killer in WP7 lists. The scrolling is already not very good there, so adding a converter between the property and the value will cause the scrolling to be even more jerky. On the other hand, if you do Silverlight 4 only, then using a BooleanToVisibilityConverter is a bit cleaner I agree.

Both Glenn Block and I (who are pretty strict about the code) agree that adding Visibility and avoiding the converter is acceptable if it provides a better UX. But I totally agree that if it causes an issue when porting the code, then you should use something else. As usual in software engineering, the correct answer is "it depends"

Hi Laurent, I really enjoyed the session while I was at MIX, thanks again for the talk, code samples, and MVVM Light! Speaking of MVVM Light, one thing I've been wondering about ever since attending your talk is which version of MVVM Light to use for new WP7 projects that will be submitted to the marketplace in a couple of months. I noticed that V4 is currently out as a Preview release, which you likened to a CTP, but I wasn't sure how much time it would take to get to the Production release. Basically, I'd like to use some of the cool new V4 features (e.g., your IoC container), but I'm afraid to do so if it means that I may run into some serious "Preview Release" bugs that cause us to have to delay the release of our WP7 app. Sorry for the vague nature of my question, but any guidance you can provide on which version of MVVM Light to use in the near-term would be greatly appreciated. Thanks!

Hi,does someone know a good way to develop a MVVM application for WPF and MonoDroid?There's this wonderful Toolkit from Laurent for WPF applications and Robert Kozaks MonoMobile.MVVM for MonoDroid (alpha-status i guess), but is there a possibility to have one Toolkit/Framework on both?

Hi Laurent, with MVVMLight was my start with Silverlight pretty fast and I was inspired by your talk on Mix last year, John Papa Kung Fu Silverlight and I was looking forward to this talk since announcement on your blog. And Its great, many thanks!!

I used MVVM Light in my first Silverlight project and I liked how it keeps things simple and clear. At the moment though, we're using Caliburn.Micro, which offers a higher level of astraction and integration at the expense of extra complexity.

One idea that I just had to, ahem, "borrow" from them (*wink*) is their RaisePropertyChanged method, which takes an Expression rather than a string. I'm sure you'll appreciate how much slicker and maintanable it makes the code. So instead of this:

I don't know how you feel about "borrowing" other people's ideas, but this is one I definitely feel is worth adding to your ViewModelBase class to end the ugliness of passing strings around. What are your thoughts?

No problems for asking! I am not entirely sure when the final release of V4 will take place. In fact, seeing the very positive response for the new bits, it might very well happen earlier than I had initially planned. That means that some of the features I wanted to build in V4 could come later, in a V5.

However, before I do V4, i have a couple of bugs I need to take care of. I am not sure exactly when I can do that. Let's go on a whim here and say that i hope I can release V4 this summer (but standard disclaimers apply

I think that this video should be redone, i.e. computer display should take the whole screen. I don't know why computer display is so unclear in this video in comparison to videos from other MIX conferences.

Remove this comment

Remove this thread

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums, or
Contact Us and let us know.