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

GridView events to ViewModel Commands

2 Answers 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michel
Top achievements
Rank 1
Michel asked on 31 Aug 2011, 06:42 PM
Hello,

Since ViewModel should not be aware of the View's content or events, I would like to link GridView events to Commands with parameters in my ViewModel, more specifically the "AddingNewDataItem" and "RowEditEndedEvent" events...

I need to initialize a new Item on the AddingNewDataItem event and need to add a new newItemRow with the RowEditEndedEvent event. We do not want to have to click the "Add Row" button of the GridView. It is unfortunate to have to write code for this behavior but I have no choice...

Thanks,

Michel

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 01 Sep 2011, 07:37 AM
Hello Michel,

You may use EventTriggers and once the event you require is fired, the command in the ViewModel will be executed. Furthermore, in case you want to pass the arguments of the event to your command, you try this Toolkit.
I am sending you a sample project illustrating the suggested approach.
 

All the best,
Maya
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Michel
Top achievements
Rank 1
answered on 01 Sep 2011, 05:31 PM
Great !

This is what I needed.

Thanks !

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