How to use MVVM Light Toolkit with existing non-MVVM Light Toolkit project - mvvm-light

I need to use the Surface project template for the application that I am working on but I also want to use the MVVM Light Toolkit too. I see that I can "Add | New Item..." and choose an MVVM teamplate for a view, view model, or locator but there seems to be a few more things I need to do to wire this up beyond adding one of those and making sure I have added the reference to the mvvm assemblies.
I am in the process of trying to figure this out by studying what's gets generated when I create a MVVM Light project but I was hoping someone already had this all figured out and documented. I know that Laurent mentioned that he was going to write this up in a blog post but I looked and could not find it. If someone knows where I can find that post that would be killer. Thanks in advance.

It's not too bad adding MVVM Light to an existing project. I finally wrote up the blog post I've been meaning to, just for this situation:
http://chriskoenig.net/2010/07/02/adding-mvvm-light-toolkit-to-an-existing-project/
Enjoy!

Related

Is there a list somewhere of all the tools MVVM light toolkit provide you with?

so I have been using the MVVM-light toolkit on a project that I am working on and I really like it.
I have used ViewModelLocator, SimpleIOC, design time data and relay commands, but i was curious if there is something else that i have missed. So what I am looking for is like list of the core tools that the toolkit provide so I can google it learn more about them.
I tried to find a decent documentation, I know about the pluralsight doc(http://www.pluralsight.com/courses/mvvm-light-toolkit-fundamentals), but I don't have a subscription and this explains why there isn't a good free one Where is the documentation for MVVM Light?.
I hope this isn't a too stupid question. Thanks
Browse all of the GalaSoft.MvvmLight.* classes in Visual Studio's Object Browser and make sure you know what is the purpose of each of them. In case of doubt look at http://www.mvvmlight.net/help/ or ask a question on SO.

ASP.Net: how to draw map

HI,
I am assigned a task to develop module for an already existing web application or to look for some third party plugin.
The web application is developed using ASP.net and C# under .Net Framework 4.0. So if i develop by myself or i go for some 3rd party plugin then in both cases, my solutions need to work with above website specifications.
What I am Assigned:
I need to draw a figure(or map) which illustrates that how companies registered on our website are connected with each other and then their sub companies, i am sorry i don't know how to explain it exactly :(, but following image would give a better idea what i want to achieve. I never do such task before, and only need guidance.
Image Taken From: http://www.visualcomplexity.com/vc/project_details.cfm?id=709&index=709&domain
Seems like you are in for some fun :)
Infragistics seems to have a Silverlight control (http://www.infragistics.com/dotnet/netadvantage/silverlight/data-visualization/organization-chart.aspx#Overview)
But you also might want to check out these as starting points:
http://code.google.com/intl/nl-NL/apis/chart/interactive/docs/gallery/orgchart.html
http://www.kyleschouviller.com/wp-content/files/Vis.html
http://www.mindfusion.eu/features-netdiagram.html
You probably don't wont to write graph code, better use some graph visualization library, look here for list :
https://stackoverflow.com/questions/44090/do-you-know-any-graph-visualization-libraries-for-net

DataBinding in Windows Phone 7?

Is there a guide somewhere showing an example of using ViewModels in a WP7 application?
You could check out Laurent Bugnion's EX14 - Understanding the MVVM Pattern - from Mix 10.
Laurent is the author of the popular MVVM Light Toolkit with support for WP7
Here's another couple of posts that may be of interest.
C#er : IMage: Model-View-ViewModel (MVVM) Explained
.NET by Example: Using MVVM Light to drive a Windows Phone 7 / Silverlight 4 map viewer
And this post gives you an overview of some of the MVVM Frameworks available.
JAPF » Blog Archive » Discover and compare existing MVVM frameworks !
While MVVM is really a great pattern (and will be even more important with Silverlight 5!), I would really consider twice if this is appropriate for your WP7 application.
Reasons:
No "Command" property for ButtonBase (it's SL3! Command was new in SL4). Therefore no easy use of Commanding-Pattern. You need to use RelayCommands, DelegateCommands or similar.
No Commanding-Pattern at all for items in the Application Bar (ApplicationBarButton or ApplicationBarMenueItem). Not even with RelayCommands, as the ApplicationBarItems do not derive from DependencyObject. :( (see http://blog.galasoft.ch/archive/2010/04/09/using-commands-with-applicationbarmenuitem-and-applicationbarbutton-in-windows-phone-7.aspx)
Dealing with Background-Threads, Dispatcher, etc. can be really cumbersome together with MVVM.
That doesn't mean, you shouldn't use MVVM!
But check out carefully, whether MVVM is a benefit for your project or an additional burden that makes depelopment over-complicated.
HTH

MVVM Light requires a reference to System.Windows in my ViewModel?

My goal was to enable the ViewModel to tell the View to present a MessageBox and ask the user a question.
I didn't want the ViewModel to have any reference to Windows-specific code.
I take the time to download and install MVVM Light Toolkit. Now I find that even with the toolkit, it is necessary for my ViewModel to reference System.Windows, in order to resolve things like MessageBoxButton and MessageBoxResult.
Why go through all this extra work, when you just wind up with a ViewModel that has a reference to System.Windows? I might as well call MessageBox.Show() straight from the ViewModel. Essentially I have saved nothing by using the MVVM toolkit, so I just don't understand why I would use this.
Can someone please explain to me, why go through this effort, if I still have to reference System.Windows in my ViewModel?
Thanks, Hugh
When you use MessageBox class, you need a reference to System.Windows.Forms.dll. MVVM-Light does NOT require this reference.
It doesn't defeat the purpose of the toolkit. The toolkit provides a light framework for separating your view from your model, which is definitely helpful with unit testing.
They reused the enums, so they didn't have to rewrite them. It definitely does seem a bit strange to reuse UI specific enums, but at least they aren't event handlers and event arguments.
Lastly, MVVM uses commands, which requires the implementation of ICommand interface. That interface is in the PresentationCore and is even more UI specific :)
Overall, the purpose isn't to remove references it is to not use those references as best you can and enums definitely don't break the pattern.
The mvvm light toolkit is there to help you implement a the mvvm pattern. The mvvm light toolkit also has the really nice advantage of being blendable, (some tweaks are made for you so you can use Expression Blend to design very easily). The Mvvm pattern also really helps (as others said) the testing of your application as it is hard to test the view but it is a lot easier to test the viewModel.
If you want to know why you go through this effort and use mvvm light I suggest you check this related answer
Hope it helps and good luck!

Customize WSAT in ASP.Net

Has anyone ever customized the website admin tool in ASP.Net? I would like to add some fields when ceating a user and keep it all in one place.
Any pointers would be appreciated.
W£as a tumbleweed :) Not sure if anyone has done this or not. I've managed to rip out the table sthat are not used and create a few views in MVC to allow Intranet\Internet MVC applications, It's working well.
If anyone requires anything like this I'm happy to help.

Resources