This is a migrated thread and some comments may be shown as answers.

MVVM delegate command two grids

1 Answer 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Goran
Top achievements
Rank 1
Goran asked on 02 Nov 2012, 02:42 PM
Hi, can someone plese point me in the right direction

I've got a page with two grids and a button.  One of the grids is multiselect and the other one is not, so users can select one or more rows from one grid and one row from the other grid and when the save button is clicked the key columns from both grids should be sved to the database,.  What I'm trying to implement is MVVM approach to saving the selections to the database.

So in the Viewmodel I've got oservable collections for both SelectedItems (on multiselect grid using  multiselectbehaviour) and SelectedItem on (single select grid), and a method to perform the db update based on the values in the SelectedItems and SelectedItem.

I've found this post http://www.telerik.com/community/forums/silverlight/gridview/using-commands-on-button-in-grid-row.aspx which was really helpfull in telling me how to implement Commands,  but I'm now stuck on how to pass selected rows from both grids to the command?  Is it possible to have multiple parameters in CommandParameter="{Binding}" or is there a better approach to pass multiple parameters to Command

Thank you,

Goran

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 07 Nov 2012, 02:59 PM
Hello Goran,

If you have bound SelectedItem and SelectedItems and have them in your ViewModel, you do not need to define command parameters. You can just get them in this ViewModel in the Execute method of the command. 
I would recommend you to take a look at this blog post for a reference on how to have the SelectedItems in the ViewModel.

 

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Goran
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or