Vaccano
Vaccano

Reputation: 82437

Does the DevExpress Grid work with MVVM and Commands (All I can find are events)

I am looking at using the DevExpress WPF Controls. But it seems that their controls (or the grid at least) use events instead of commands (not MVVM friendly).

I have seen several ways out there to do Event-to-Command conversion. But they all seem a bit hacked to me. And I have read that they break down when attached to parts of the DevExpress Grid.

I am just getting going on some Blue-Sky development and hacking my UI from the get go seems like a poor idea.

Does the DevExpress Grid work with MVVM and commands? (ie am I missing something?)

If not, does Telerik? Or any other control venders?

Right now the only one I am seeing that seems to do it is Xceed. Are they my only option if DevExpress is as limited as it is seeming to be?

Upvotes: 2

Views: 3902

Answers (1)

EtherDragon
EtherDragon

Reputation: 2698

Telerik definately works with Commands. However any WPF control can map behaviors to commands by using System.Windows.Interactivity.

Article to paruse http://www.danharman.net/2011/08/05/binding-wpf-events-to-mvvm-viewmodel-commands/

The important bit is:

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
...
<DevExpressControl>    
    <i:Interaction.Triggers>        
        <i:EventTrigger EventName="MouseEnter" >
            <i:InvokeCommandAction Command="{Binding FooCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
</DevExpressControl>

So, in just a couple of xaml lines, you bind an event to a command.

Upvotes: 1

Related Questions