passing multiple selected items from grid view to viewmodel

Apr 19, 2013 at 3:30 PM
Edited Apr 19, 2013 at 9:01 PM

Could you (or anyone else for that matter) provide some insight on the best way to pass multiple selected items from a WPF grid view into a view model. I have tired using Interaction.Behaviors but with no luck. I can't seem to get any selected event to trigger within the VM.


so this doesn't seem to be a clean alternative but it seems to work for the intermediate time.
I added to the Grid a selectedchanged event and then within the view codebehind I a call the Viewmodel property as follows:
private void gv_SelectedSource_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
            vm.SelectedSourceItems = gv_SelectedSource.SelectedItems;

        protected BulkImporterViewModel vm = new BulkImporterViewModel();
I don't really like making the view aware of the viewmodel but this seemed to be the only way I could find to pass a collection of selected items from the view to the viewmodel.

I'd welcome any suggestions on any better approaches.
update 2__

I spoke too soon the above is not a viable approach as it generates two instances of the viewmodel (ie separate context) so this approach is no go.