I'm new to MVVM and Silverlight and I'm just trying to figure out a simple scenario.
I'm using the MVVM Light toolkit and Silverlight 3.0 without Expression Blend.
I have a DataGrid and a DataForm bound to an observable collection in a ViewModel. I would like to bind to my RelayCommand Save()
property after I make changes to the data in the DataForm control and have this accomplished without using the code behind for my view.
The DataForm doesn't use the cmd:ButtonBaseExtensions.Command
that MVVM Light uses for normal button click command binding, so I'm not sure how to tie the control to my ViewModel.
Any help is appreciated!
Best Answer
I figured it out shortly after posting the question. Go figure.
When using the MVVM Light Toolkit you can bind to events using the
EventToCommand
feature.My Xaml looks like this:
And my ViewModel looks like this (using direct silverlight enabled WCF service in ViewModel for quick example, would normally pull this into an interface to decouple):