Comments

To add the template to VS 2010, download the template for VS 2008, create an empty project in VS2008, close VS 2008. Open the project with VS 2010 and convert it. Export the project as a template. You can either automaticall import into VS 2010 in which case it will appear under the root c# project templates. Or you just create the project template and manually place under \Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\Windows\1033 to place it in the Windows sub section.

As many of you have pointed out, the toolkit has not been updated for VS2010. The toolkit was really intended to be an introduction to MVVM, it was not intended to replace the community libraries available. In the hope that some will find it useful, I have created a VS 2010 extension that behaves as a hands-on-lab and walks through some of the basics. I'll mention that this is an unofficial release, given I no longer work on the WPF team. Link: http://visualstudiogallery.msdn.microsoft.com/af12ce3b-8337-4bbb-853f-9fdad7105ec8

@Nitro52: Thanks for taking the time to comment. Out of curiosity, are you using the Model-View Visual studio template to create your project as part of the sample walkthrough? The reason why there is no mention of hooking up the View Model and data context in the walkthrough is that it's actually done for you by the template. I definitely hear you in that it should have been made more explicit, not just to better illustrate what is happening, but for anyone who wishes to use the walkthrough without being forced to use the template.

Hey all. I'm trying to run the included Messanger.Demo application without any luck. I go to login and it never succeeds. The only thing I see in the Output window in VS.net is "Messenger Connection Established". Anyone else have problems running it?

I deleted my last comment as it may have been unfair. However, I would still like to see an elegant solution to handling dialogs and dialog results as well as VM 2 VM and V 2 VM communication in an elegant way that isn't coupled. This toolkit offers an excellent starting framework but if you plan on using it be aware that, in its current state, you will need a lot of additional plumbing for scenerios with multiple views and view models that require communication and data passing (i.e. dialogs and results). Sacha Barber has a detailed series of articles on how he addresses some of these scenerios with his MVVM WPF Framework Cinch: http://www.codeproject.com/KB/WPF/Cinch.aspx and gives credit to others who have come up with inventive solutions.

@rogerrong: Good question. The primary reason is one of dependencies. In .Net 3.0/3.5, the ObservableCollection class is defined in one of the primary WPF assemblies. Many existing applications that already have data models defined were built on top of .Net 2.0 and don't take WPF dependencies, so as to make it easy to reuse the data models in other places. The NotificationCollection class was to illustrate one way to work around the lack of ObservableCollection; if this isn't a concern for your particular scenario, then using ObservableCollection is perfectly fine, and in fact preferable if it saves from having to write and maintain more code. I'll also mention that the current plan is to type forward ObservableCollection to System.dll in .Net 4.0 for similar reasons. Thanks!

There is a NotificationCollection class defined under the Models of the Messenger.Demo sample project. It looks similar to the ObservableCollection class. I am just wondering why bother to spend effort building such a big class instead of using the ObservableCollection straightforward.

Does the NotificationCollection provide any feature not covered by the ObservableCollection? If the NotificationCollection is a better option to be used by the Models classes, should it be included in the project template?

Please note the Walkthrough - part 2 has a small error. On Page 9 under the App OnStartup, the following lines need to be changed ... not just the addition of the call to LoadContacts (it's not really an error, just a lack of high-lighting ...)

@sixmileal:You are right on! To be frank, we are still in the process of nailing down exactly what such a foundation should contain. The fundamental patterns themselves are well understood. What we don't quite understand yet is where the sweet spot is when it comes to simplicity, framework support, toolability, as well as all the other fundamentals (deployment, localization, etc.) -- that's why we currently have different solutions satisfying niche needs (from MVVM toolkit, Prism, the SCE toolkit, etc.) as opposed to an overarching good-for-all-scenarios solution. I am sure we will get there eventually, so please keep this feedback coming.

For those having issues with the example in part2, check that in OnStartup in App.xaml.cs the line - which is not marked - 'view.DataContact = mainViewModel;' replaces the 'view.DataContext = new ViewModels.MainViewModel();' line. Otherwise the app is using a fresh instance without anything attached, which explains the empty Main Window. This simple hands-on tutorial is very valuable for us new to WPF. Thanks a lot! Indeed simplicity is welcome in this jungle of frameworks and variations.

@HtechDev: WPF supports navigation through the use of a 'Page' object, showing a navigation bar at the top of your application which makes it look a little bit like a web browser, but it's not a website (ASP.Net has its own MVC toolkit, if your intent is actually to build a website).

Having said that, this initial release of the M-V-VM toolkit doesn't include a framework for getting navigation to work "out of the box". We're aware of this, but it's good to know it's a feature you would find valuable and will consider it for a future release of the toolkit. Thanks!

To be honest, I'm not 100% sure. I simply created a WFP Application within Visual Studio and changed Window.xaml to Page.xaml. Then changed the Xaml <Window> tag to <Page>. I ended up with a website to replace my old ASP.NET 2.0 version. But know I'd like to convert it to use the MV-VM design pattern.

Is there a different MV-VM template I should use for web page creation rather than windows? Or does some type of checklist exist that will lead me quickly through the items I need to change? e.g. Change all "Windows" in xaml to "Page."

Would I be incorrect in stating that the core problem being addressed by the ‘Model-View-X’ patterns is one of dependencies? To me, each one is simply a different approach at reconciling the dependency requirements that naturally exist between the different layers (Presentation-Presentation Logic-Model). If that is the case, would we not be better off resolving the much larger problem than coming up with variants? I think what is required is the missing ‘foundation’ member, WXF. A foundation member that would provide some of the facilities that are now being addressed through initiatives like Prism. If we leave out the UI aspect being solved with the RegionsManager, the remaining services are fundamental to all applications. And those being, a dependency injection/resolution mechanism (the solution to a lot of problems not just Model-View-X), a locator/loader service, and instancing/lifetime management. Some of these facilities are available for the WEB counterpart but not for the desktop. Perhaps I am being naïve in my viewpoint, but I see all Windows applications benefiting from how a Prism application is defined. Maybe WXF would provide a new meaning for ‘AppDomain’, where applications simply state their composition (modules), what their dependencies are, and the module instancing requirements.

@ggovedar: I've actually been working on a more complex (and complete) M-V-VM sample that connects to a SQL CE database, so I hope we can release that sample soon. You can find some relevant information here: http://karlshifflett.wordpress.com/mvvm/wpf-line-of-business-introduction/The model often interacts with a data layer, and I've used the singleton pattern to create a data source and use that throughout my application. Depending on the underlying technology and how complex you want to get, you could then write async methods to get data/update status/allow for cancelling. In general, I try to abstract data service implementations from the model classes, as it makes it easier to swap one out without affecting the other layers. Hope that helps!

@WPFUser: The initial release of the template only works on English languages of VS. We're aware this is a big pain for the numerous people who don't use English software, and we plan on correcting that in the next release.

First of all, thank you for the toolkit, it's really good introduction to MVVM principles!How would you go about connecting to SQL server database(using LINQ) as dataprovider in Models? I've tried adding a dbml file to the Models directory but I'm stuck with instantiating DataContext (where should this be done) and retrieving data from the DB. Any guidance/links to helpful blogs/posts would be much appreciated!

I cannot seem to create a project. Error: This template attempted to load an untrusted component. Microsoft.VisualStudio.Presentation.Extensions, Version 9.0.0.0, etc... see documentation on Customizing Project Templates.Well, WHERE??? HOW???

The project template doesn't work for me. I have Visual Studio 2008, (german Version) I installed it but i can't see the project template (yes, I have marked .NET framework 3.5, and i have 3.5 SP1).What can we do ?

@RogerFeeley: The WPF Toolkit and the WPF M-V-VM Toolkit are two separate product releases. In order to get the M-V-VM project in VS 2008, you would need to download and install the latter from the WPF Futures page (currently at http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962).

I have downloaded the WPF Toolkit but I'm not sure it's the right one. To see if the MVVM is properly installed, I create a new project and click on 'Windows' under the C# folder. I should see 'WPF Model-View Application' but I don't. I take this to mean that I haven't installed the right thing. The links keep taking me to WPFToolkit.msi. It seems to me that there should be a WPF M-V-VM Toolkit.msi somewhere.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB944899) KB944899This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/944899.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB945282) KB945282This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/945282.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946040) KB946040This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/946040.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946308) KB946308This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/946308.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946344) KB946344This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/946344.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946581) KB946581This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/946581.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947171) KB947171This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/947171.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947173) KB947173This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/947173.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947180) KB947180This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/947180.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947540) KB947540This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/947540.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947789) KB947789This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/947789.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB948127) KB948127This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/948127.

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB953256) KB953256This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this hotfix will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/953256.

Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB945140) KB945140This service pack is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this service pack will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/945140.

Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB947888) KB947888This service pack is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this service pack will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/947888.

Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB956453) KB956453This update is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this update will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/956453.

Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB967143) KB967143This update is for Microsoft Visual Studio 2008 Professional Edition - ENU.If you later install a more recent service pack, this update will be uninstalled automatically.For more information, visit http://support.microsoft.com/kb/967143.

Thanks! I thought I was losing it. Glad to know that I'm understanding things properly.

I am going to be using the sample project (with the ViewModel *not* interacting directly with the DAL!) as a springboard to a MVVM project at work. Unfortunately, my employer requires all projects to be done in VB.NET. C# is expressly NOT allowed. This was a drag because the MVVM Toolkit only has a C# project.

So, I went ahead and took the output of the C# project and converted it to VB.NET, and got it running. At least, the Exit command definitely works, so I assume I have it all wired up properly (although the CommandReference.cs and DelegateCommand.cs files were a bit of a challenge to transliterate into VB.NET parlance!).

Is there someway for me to share this VB.NET version of the basic project with you guys, so nobody has to go through the same pain?

@timhaynes:That's a great observation, and I'll correct that in an upcoming version of the toolkit. In order to better layer the application (as simple as it is), it would have been preferable for the ViewModel to interact with the Model, and have the Model interact with any data access technology, so that should said technology change, only the Model would be potentially affected.

Thanks for publishing this toolkit. It has really helped me cut down my ramp-up time on WPF and MVVM.

I have one question, which is probably because of my inexperience with this pattern. Why is the MainViewModel.LoadContacts method aware of the ContactsDataSource class? I thought that the point of the ViewModel was to bind the UI to the Model. Although this certainly happens via the MainViewModel.LoadContacts class, I was expecting LoadContacts to talk to the Model only. The Model would then interact with the ContactsDataSource and pass the results up to the MainViewModel.

Am I wrong about the ViewModel? Is it allowed to interact directly with the data access layer??

@David One issue with events instead of commands is that you cannot place events in a template (control template, data template) and then move the template to an external resource dictionary. The compiler will look for the event handler, won't find it (because resource dictionaries don't have code behind) and will break. Commands are more loose (looser?) and do not present the issues that events and their tight link create.

RelayCommand/DelegateCommand is just a simplification of the ICommand concept, encapsulating the complexity.

Do you have a rough estimate on when will the revised walkthrough/guide released? I've tried to follow it step by step but got stuck (forgot where, but I think most people here who followed it step by step has the same problem) and since I'm pretty new to WPF/MVVM stuffs, I couldn't move any further.

@David:Although there is some debate about this in the M-V-VM community, part of the goal we had with the toolkit was to ensure business logic be kept in the view model, requiring as little code-behind as possible, and leveraging declarative XAML as much as possible.

Generally speaking, there is nothing wrong per se with using events, but one of the key issues with event handlers is that business logic frequently creeps its way in them (I've seen it happen!). In addition, when testing the view model logic, you then have to assume the method you think is being called by the view to perform an action is in fact the one (and only one) being called.

Although you don't get the benefit of compile time checking, by using DelegateCommand/RelayCommand, you ensure that the logic is kept in the ViewModel and avoid any doubt. Your point about compile time checks is a good one though. In fact, the same issue affects data binding in WPF as a whole, and we're aware that debugging can be painful.

I believe that I understand and appreciate most of the MVVM feature with the exception of commanding (using ICommand - RelayCommand, DelegateCommand, etc.).I understand that the VM should not be aware of the View - makes good sense for testability; however, I don't understand the need for using the RelayCommand or DelegateCommand.I understand that many purist insist on no code in the View's code behind; however, I am a minimalist and a pragmatist so it's okay :-)

For the sake of this discussion, let's ignore CanExecute.

So why do we need ICommand? Since the View can have its DataContext set to the respective VM object why can we not simply implement an event handler in the View code behind and use the DataContext to call a command handler directly in the VM with a single line of code? What do I gain by adding the complexity of a RelayCommand or DelegateCommand (ignoring CanExecute)?

The VM command handler can do just about anything needed on the View by just changing VM properties that the View has bound - the VM does not need and should not have a reference to the View.

By using an event handler in the code behind I gain compile time checking of the control's event name string attribute - I don't believe that the RelayCommand or DelegateCommand provide compile time errors for mistakes in a controls command string attribute.

In short, a single line direct call from an event handler in the View's code behind: - takes significantly less code to implement - gives compile time checking

I suppose that some may say that the View is now aware of the VM; however, it already is if it is using data binding to the VM.I am sure that there is something that I don't understand so a short tutorial or reference on what I am missing would be appreciated.

@danutzp:We definitely hear you with respect to this being a start, but we felt releasing incrementally and getting feedback like yours so as to focus on the right topics for the next release, was preferable to working in the dark and releasing something that could end up completely off-base. Having said that, we will be addressing the window management issue more explicitly in an upcoming release.

In the meantime, we included a more complex sample (The Messenger sample) which shows a way (note: not the only way) of dealing with more than one window without moving too far away from the principles of M-V-VM.

@ivom:The walkthrough you guys provide should be expanded to include the cases when data binding does not work. For example if the user selects (or double clicks) an item in the list box then a second window pops up and gets populated with the data corresponding to the selected item in the list box.

You cannot data bind SelectedIndex of SelectedItem to a command so how do you glue this to the ViewModel? Some code behind in the View that forwards it to the ViewModel or you bind to a property of the ViewModel?

Part 1 of the walkthrough shows the UI for this behavior on page 3, Figure 1. What would be the MVVM way of implementing this behavior?

I think your walkthrough is great for a beginner who wants to learn what MVVM is and how it is implemented but for more complex scenarios I would like to propose a part 3 of the walkthrough that shows cases where data binding and commands do not work.

@PatrickDanino. Yes, I know but it didn't works. I installed other templates like silverlight o asp.net mvc and its work.I have to do a little hacking with your template (sorry about that).I have VS2008 with C# support enabled. My version is: 9.0.30729.1 SP (3.5 SP1). Spanish version.

Otoh, I'm the only one that the messenger crash when i Log in? (it didn't show the contacts)

@geophil:Good feedback! We can probably provide support for NUNIT (and xUnit) in the next revision of the template.

@bashton:Thanks for taking the time to do that. Please send us (wpftbest@microsoft.com) the revised version of the document and we will factor in the feedback in the next revision of the toolkit. Any feedback is greatly appreciated!

@usrini:We have not tried building an XBAP application, but there aren't any limitations in the template-generated code we are aware of. We will take a look at this and get back to you.

@danutzp:Re your first question:MVVM is a design pattern and as such it does not dictate specific implementation details (although opinions on that vary ). Most WPF applications can be adapted to follow the pattern fairly closely. MVVM makes use of data-binding and commanding, but in reality data-binding is really just WPF-esque adaptation of the “observer” pattern – it’s a “off-the-shelf” facility provided by WPF to facilitate a common need, which you can reimplement with other means (we do not suggest that – but it is possible if your app has specific needs). Really, the meta point of this toolkit is to direct folks to build applications with model-view separation, as a proven best practice.

Re second question:Acropolis was a much broader effort -- a lot of its ideas did make their way into WPF/Silverlight. As far as MVVM tooling is concerned -- we already have a fairly solid tooling story in Cider (that is getting a bunch of additional facilities in Dev10), so one can easily imagine a simple straightforward tooling experience for MVVM applications once we clarify the usage patterns and workflows based on your feedback (please keep the feedback flowing -- it's very valuable!) I am convinced that we can deliver a very simple (simple is good!) straightforward tooling experience, by combining targeted platform and tool modifications.

>ivom wrote May 5 at 11:53 AM:>Imagine a tooling experience where you can easily hookup >elements of your UI to commands or methods on your viewmodels. >This is something that we may consider implementing in the future, >once we clarify the specific needs.

@ml_black:Would you remember at what point in the walkthrough does the problem happen? The two really should match, so I'd like to make sure the walkthrough is correct and spare everyone the trouble of having to work around it! Thanks for taking the time to use the toolkit and template!

@Number8:First step would be to make sure the data is being loaded from the data source (XML file) correctly; you can do so by putting a breakpoint in the OnStartup method (Step 15) to ensure it's being loaded. The second step would be to check the XAML file and ensure the binding matches the property name in the ViewModel (step 18). If you run a WPF application in debug mode, you can see information about binding issues in the Output window of VS. Hope that helps!

@Foxandxss and others:You should only need to install the MSI to get the template to work in VS 2008, assuming you kept C# support enabled when installing the product. If you could provide us with the version of VS (as indicated in Help -> About menu), that would also be helpful for us. Thanks!

Very good effort to make MVVM pattern learning easy. Simple sample to follow and it worked for me. Now, I am trying to change and extend the sample into an XBAP application. So, I tried to take the code in App.xaml.cs into the first page constructor. It did not work. Has any made similar attempt to apply this patten to XBAP application?

@ivom, I didn't touch the $if$ thing. I extracted the files on the .msi, installed the msi (because I don't know where to put the .dll file), and copied the two .zip files to the Project Templates folders on My Documents.

I have a commented revision of the "Model-View WPF Applications--Part 2, Walkthrough.docx" that contains comments on the minor corrections that I found were needed to successfully build the app from scratch. Is there somewhere to send it to the team so that you can confirm my comments and refine the document?

Hi. amdys is right. I mean that I was building the app from scratch, according to the directions in the "Model-View WPF Applications--Part 2, Walkthrough.docx". I can get the sample code to build without problem, but the directions in the document are not correct.

Well, installing the toolkit (for the dll), and copying the two zip to the templates folder of VS (in My Documents), it works. OTOH, the messenger example didn't work. It connect, the debugger window show the contacts but it crash with a TargetInvocationException and the debug windows says InvalidCastException. No lines or something like that. If you need more information, tell me.

@SailTsao, nothing. I extract the .msi, I extract the project zip, delete the $if$ statement with it lines, compress the file again, install but nothing. It doesn't show the project template. I think that is problem of the template itself, but not the csproj. Anyway, thank you.

@FoxandxssIt doesn't work for me too.And I have Visual studio 2008 too.But after I Extract the setup file And modify the WpfModelViewApplication.csproj file,it's work for me.I delete the $if$ statement.

The project template doesn't work for me. I have Visual Studio 2008, I installed it but i can't see the project template (yes, I have marked .NET framework 3.5, and i have 3.5 SP1). I have the silverlight toolkit and it works, even asp.net mvc template.

Ivom :The default WPF template in Visual Studio, while great for lowering the entry barrier to WPF, is not suited for any sufficiently complex application. PRISM on the other hand is great, but it is a fairly complex solution that is not easy to grasp. Besides, it deals with a slightly different problem (composable UI). There have been a lot of great articles on MVVM, but we have also seen a fair number of people struggling with finding the single definitive article and ending up doing the wrong thing. That is why we decided to release the toolkit and that’s why we decided to keep it simple and “easily graspable”. What we want to achieve is “ease the entry into the MVVM domain”, not provide a definitive, all-encompassing guide – at least not in v.0.1.

I am with you. just starting learn wpf less than 3 months. Using this toolkit today help me alot understand it better. Maybe i will better grap that prism next time. Not much time for now frankly...so keep it up guys. cant wait for next version.

I think what ml_black means that if you follow the walkthrough step by step like a beginner like me. Its really not working thats why he and me need to look at finished working app which yes working fine. ex step 9. It will raise error.

Ivom :The default WPF template in Visual Studio, while great for lowering the entry barrier to WPF, is not suited for any sufficiently complex application. PRISM on the other hand is great, but it is a fairly complex solution that is not easy to grasp. Besides, it deals with a slightly different problem (composable UI). There have been a lot of great articles on MVVM, but we have also seen a fair number of people struggling with finding the single definitive article and ending up doing the wrong thing. That is why we decided to release the toolkit and that’s why we decided to keep it simple and “easily graspable”. What we want to achieve is “ease the entry into the MVVM domain”, not provide a definitive, all-encompassing guide – at least not in v.0.1.

I am with you. just starting learn wpf less than 3 months. Using this toolkit today help me alot understand it better. Maybe i will better grap that prism next time. Not much time for now frankly...so keep it up guys. cant wait for next version.

I think what ml_black means that if you follow the walkthrough step by step like a beginner like me. Its really not working thats why he and me need to look at finished working app which yes working fine. ex step 9. It will raise error.

Ivom :The default WPF template in Visual Studio, while great for lowering the entry barrier to WPF, is not suited for any sufficiently complex application. PRISM on the other hand is great, but it is a fairly complex solution that is not easy to grasp. Besides, it deals with a slightly different problem (composable UI). There have been a lot of great articles on MVVM, but we have also seen a fair number of people struggling with finding the single definitive article and ending up doing the wrong thing. That is why we decided to release the toolkit and that’s why we decided to keep it simple and “easily graspable”. What we want to achieve is “ease the entry into the MVVM domain”, not provide a definitive, all-encompassing guide – at least not in v.0.1.

I am with you. just starting learn wpf less than 3 months. Using this toolkit today help me alot understand it better. Maybe i will better grap that prism next time. Not much time for now frankly...so keep it up guys. cant wait for next version.

I think what ml_black means that if you follow the walkthrough step by step like a beginner like me. Its really not working thats why he and me need to look at finished working app which yes working fine. ex step 9. It will raise error.

Ivom :The default WPF template in Visual Studio, while great for lowering the entry barrier to WPF, is not suited for any sufficiently complex application. PRISM on the other hand is great, but it is a fairly complex solution that is not easy to grasp. Besides, it deals with a slightly different problem (composable UI). There have been a lot of great articles on MVVM, but we have also seen a fair number of people struggling with finding the single definitive article and ending up doing the wrong thing. That is why we decided to release the toolkit and that’s why we decided to keep it simple and “easily graspable”. What we want to achieve is “ease the entry into the MVVM domain”, not provide a definitive, all-encompassing guide – at least not in v.0.1.

I am with you. just starting learn wpf less than 3 months. Using this toolkit today help me alot understand it better. Maybe i will better grap that prism next time. Not much time for now frankly...so keep it up guys. cant wait for next version.

I think what ml_black means that if you follow the walkthrough step by step like a beginner like me. Its really not working thats why he and me need to look at finished working app which yes working fine. ex step 9. It will raise error.

Ivom :The default WPF template in Visual Studio, while great for lowering the entry barrier to WPF, is not suited for any sufficiently complex application. PRISM on the other hand is great, but it is a fairly complex solution that is not easy to grasp. Besides, it deals with a slightly different problem (composable UI). There have been a lot of great articles on MVVM, but we have also seen a fair number of people struggling with finding the single definitive article and ending up doing the wrong thing. That is why we decided to release the toolkit and that’s why we decided to keep it simple and “easily graspable”. What we want to achieve is “ease the entry into the MVVM domain”, not provide a definitive, all-encompassing guide – at least not in v.0.1.

I am with you. just starting learn wpf less than 3 months. Using this toolkit today help me alot understand it better. Maybe i will better grap that prism next time. Not much time for now frankly...so keep it up guys. cant wait for next version.

I think what ml_black means that if you follow the walkthrough step by step like a beginner like me. Its really not working thats why he and me need to look at finished working app which yes working fine. ex step 9. It will raise error.

@ml_black:Do you mean the Messenger Sample app? That builds fine on VS 2008 -- I just confirmed that again downloading a fresh copy of the ZIP file. Note that after you download the ZIP you may need to "unblock" it (right-click on it > Properties > Unblock)

Has anyone actually tried to build the sample app in this toolkit? There are lots of errors in the code. I've fixed the ones I've encountered so far, but where I'm not so familiar with delegates, I'm having trouble getting around the problem of converting the boolean returned by the private CanClearContactBook method into the System.Func<bool> required by the delegate command.

First of all, thanks for your feedback and for taking the time to provide it. It is much appreciated!

There are three reasons why we released the "WPF MVVM Toolkit" in its present form: a) Provide simple MVVM ramp-up guidance to WPF developers b) Demonstrate general direction and solicit feedback from the WPF / MVVM community c) Identify and correct limitations in the WPF platform d) Test and prototype tooling experiences for MVVM applications

Re (a):The default WPF template in Visual Studio, while great for lowering the entry barrier to WPF, is not suited for any sufficiently complex application. PRISM on the other hand is great, but it is a fairly complex solution that is not easy to grasp. Besides, it deals with a slightly different problem (composable UI). There have been a lot of great articles on MVVM, but we have also seen a fair number of people struggling with finding the single definitive article and ending up doing the wrong thing. That is why we decided to release the toolkit and that’s why we decided to keep it simple and “easily graspable”. What we want to achieve is “ease the entry into the MVVM domain”, not provide a definitive, all-encompassing guide – at least not in v.0.1.

Naturally, if you are already well-versed in PRISM and/or MVVM, you don’t need this toolkit. If you, however, are trying to pick up WPF or trying to figure out how to achieve model-view separation in your WPF application, we suggest you read through the guidance and the samples .

Re (b):We know that there is a lot of passion and expertise around MVVM out there. We invite everybody who is passionate about this space to collaborate with us to come up with a simple, easily-graspable, complete MVVM solution that we can then integrate in Visual Studio. So please, send us your feedback.

Re (c):Even though you can obviously build WPF MVVM applications today, there are certain limitations in WPF that force you to do “unnatural acts” in order to accomplish proper model-view separation. An example of such limitation is the fact that you cannot bind a routed command to a viewmodel (which is typically not part of the element tree) – this is worked-around by solutions such as DelegateCommand / RelayCommand / Etc. Another limitation is the fact that you cannot bind input gestures to commands on the viewmodel (because the Command, CommandTarget and CommandParameters properties on InputBinding are not DPs) – we are considering fixing this in WPF 4.0.

Re (d):Imagine a tooling experience where you can easily hookup elements of your UI to commands or methods on your viewmodels. This is something that we may consider implementing in the future, once we clarify the specific needs.

So I invite you to work with us and help us deliver a simple, natural, componentized, toolable MVVM solution. A lot of you have very valuable real world application experience that we’d like to tap into.

This is yet more confusion to us all. The whole MVVM paradigm for WPF is now getting way out of control. Trying to decide on the best approach I am torn between so many differing approaches regarding WPF. I hope I’m not alone here. Here’s my gripe:

3. Next up Julian Dominguez’s blog and subsequent Spike shows us how to implement Josh’s pattern using Prism. http://blogs.southworks.net/jdominguez/2008/09/presentation-model-with-datatemplates-in-compositewpf-prism-sample/

4. And now we have this MVVM toolkit which uses neither of Josh’s or Julian’s approaches. In fact it offers little other than a template project with a few folders.

5. And now I here of something called ‘Caliburn’. http://caliburn.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=23840

STOP!!!! Where will it all end.

There currently seems to be a million and one ways in which people are coming up with best practices for Model-View separation, with no clear standard. Currently I’m using Prism with a vaiation of MV described in Julian Dominguez’s blog. Please, please, please can someone offer some kind of ‘Guidance’ as to the best practices we should all be using for WPF. After all, isn’t that what CodePlex and P&P is all about.

Thanks for reply. I'm confused about the RIA Services. I thought RIA Services allow to easily retrieve data ( Mainly for SL apps ). Brad mentioned RIA Services are on the roadmap for WPF. Do you know when we will get Bits that support WPF? Anyway, could you explain more about similar or differences of this M-V-VM toolkit and RIA Services? Is one based on WPF and the other for SL? Can they be used together? Thanks again.

Thanks for the kind words and the great questions. Part of the goal in releasing the toolkit early is to gather feedback, which will directly impact the plans we have for it, including getting the template in VS 2010. With respect to Silverlight, there is an ongoing effort by Brad Adam's team to develop rich internet application services, and they currently have a toolkit of their own (see http://code.msdn.microsoft.com/RiaServices).

MEF provides a lot of functionality, much more than is currently included in this toolkit. Learning how to take advantage of all those features does require more time though, so our hope with this early release is that a person who is not very experienced with M-V-VM could start with this toolkit, get familiar with the pattern, and then make use of MEF (or other M-V-VM frameworks) based on the complexity and requirements of the scenario. In addition, part of the feedback we get will help decide if we will develop as part of the template a more complete M-V-VM framework, use an existing one, or keep things as-is and let each person use their preferred framework. Hope that helps clarify!

Great stuff. This has good details on topic and got me running in no time. Is there plans on releasing something like this for Silverlight? Will the template be a default project type in VS 2010? Thanks.