MVVM delegate command two grids

2 posts, 0 answers
  1. Goran
    Goran avatar
    2 posts
    Member since:
    Oct 2012

    Posted 02 Nov 2012 Link to this post

    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
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 07 Nov 2012 Link to this post

    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.

Back to Top