Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1770
Getting index of selected row/cell using mvvm
posted

Hello. I'm having a hard time understanding how I can get the row index of a row/cell that a user clicked on. I understand there are several ways of doing this like behaviors and binding to the ActiveCell. I've tried to implements this post -> http://stackoverflow.com/questions/10838573/infragistics-xamdatagrid-wpf-mvvm-selectionchanged with no luck. First what type is ActiveCell so I can create a property of it? I've looked at the Cell and ActiveCell class but I can't figure out what namespace to import.

public ActiveCell _selectedCell;
public ActiveCell SelectedCell
{
get { return _selectedCell; }
set { Set(() => SelectedCell, ref _selectedCell, value); }
}

<igWPF:XamDataGrid ActiveCell="{Binding SelectedCell}" />

I've also tried

<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectedItemChanged" >
...
</i:EventTrigger>
</i:Interaction.Triggers>

The SelectedItemChanged event does not seem to be firing when I click on a cell..

Is that the best approach or should I use behaviors which seems to me a bit excessive. Any suggestions with some code examples would be greatly appreciated.

Thanks