Prism4 + wpf + DataGrid triggers

Topics: Prism v4 - WPF 4
Jun 15, 2011 at 9:17 AM
Edited Jun 15, 2011 at 2:28 PM


My project is .Net FW4, WPF and PRISM4.

I have a <DataGrid/> which has a number of columns where one of them is of type <DataGridCheckBoxColumn/>. I'd like to be able to raise an event on the underlying ViewModel (this is a MVVM based project) and have therefore declared a method such as:

public ICommand PlotClicked { get; private set; }

In the constructor of the ViewModel I've created a DelegateCommand

this.PlotClicked = new DelegateCommand<object>(this.OnClick, this.CanClick);

Now, in the XAML-file of my View I have the following:

<DataGridCheckBoxColumn ...>
<i:EventTrigger EventName="??????"> // I'm not sure what to put here...
<i:InvokeCommandAction Command="{Binding Path=PlotClicked"}"... />
When clicking the checkboxcolumn nothing is fired in my ViewModel. I'm a complete newbie to the concept of Interaction.Triggers so I've definitely missed something here...
I hope somebody will be able to point me in the right direction...
Jun 15, 2011 at 3:00 PM


One possible way to fulfill your requirement could be to define the command in your DataGrid’s Item Template, for example, triggering the command when you click the items.

In order to do so, you need to access your command that resides in your ViewModel from within a DataTemplate (whose DataContext is overridden), therefore you should implement one of the possibilities described in the following threads:

Please, let us know if this information helps you.


Miguel Bronzovic