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
Hi Kris,
I’m a little confused by your comments. Are you looking for the currently ActiveCell’s row index or are you looking for the SelectedCell(s).
The xamdataGrid has an ActiveRecord property and an ActiveCell property, which is a Cell, and it has a property Record which in turn has a property Index. That might be all you need.
There are CellActivating and CellActivated event which you might use depending on whether you need to get the cell before is it activated or after the activation is completed.
This link may be helpful.
http://help.infragistics.com/doc/WPF/2014.1/CLR4.0/?page=xamData_Selection_Overview.html
Depending on your settings, LabelClickAction and SectionTypeCell or SelectionTypeRecord, you could be able to select Records or Cells or Fields and you could be able to select one or many.
A SelectedCell might not be the ActiveCell, since it is possible for there to be multiple selected rows or cells but only one active cell or active row.
It would probably be best if you can give me your xamDataGrid xaml and explain to me which you need, the active cell’s row index or a selectedcell’s row index.
Have you been able to put a small sample together?
I hadn't heard back from you and I'm wondering if you had any further questions.