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

MVVM Command support - suggestion

3 Answers 67 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ManniAT
Top achievements
Rank 2
ManniAT asked on 02 Jul 2014, 01:49 PM
Hi,

over the year more and more things have become "bindable" - a must have for MVVM.
What I still miss is Command Support.

Example - RadGridView.
I need special logic to store (insert / update) a row in the database.

What I have to do is handle the RowEditEnded (and if I need RowValidation) also the RowValidating events.

I solved this by subclassing the RadGridView and offering a "RowEditEndedCommand" and a "RowValidatingCommand" as ICommand.

Now I can handle the things without code behind.
Something like <xx:MyGridView RowEditEndedCommand="{Binding MySpecialCommand}"...

And what I got is a thing like a Button - I still can handle Events (OnClick) - but I can also bind a Command from my VM.

I don't know if I'm the only one with this need....

Manfred

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 04 Jul 2014, 11:51 AM
Hello Manfred,

Generally, you can combine events and commands through EventToCommandBehavior. More information about it can be found in our documentation explaining how you could benefit from it. 
Does this approach meet your requirements ? 

Regards,
Maya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
ManniAT
Top achievements
Rank 2
answered on 04 Jul 2014, 05:00 PM
Hi Maya,

I know about this option and my post was just a suggestion.

Using the behavior is like using glue to add an (in MVVM) always needed handle.
While (what I suggested) the manufacturer could ship the product with a handle already attached.

Something like the IsReadonlyBinding on a GridViewDataColumn - of course I could mess around with ancestor bindings and so..
But you provided this very helpful property - which keeps the XAML clean and makes the things a lot easier.

Manfred
0
Maya
Telerik team
answered on 08 Jul 2014, 08:47 AM
Hi Manfred,

As far as I understand, you suggest to have a Command for each event that RadGridView provides. This does sound like a good idea, but the thing is that there are quite a lot of events and it might be a bit overwhelming to have both events and commands connected to them since we do have an EventToCommandBehavior. 
Nevertheless, I will talk with the team to verify if this is something we would do. Thank you for the feedback.


Regards,
Maya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
General Discussions
Asked by
ManniAT
Top achievements
Rank 2
Answers by
Maya
Telerik team
ManniAT
Top achievements
Rank 2
Share this question
or