By default, I get cell highlighting on MouseOver and cell selection on Click. I don't want either of those. When I click on any cell, I want the entire row selected and I don't want the RowSelector visible.
When the row is selected, I need to then call a command on the View's corresponding ViewModel using MVVM Light toolkit's EventToCommand.
In the grid, set the selection settings:
<igGrid:XamWebGrid.SelectionSettings> <igGrid:SelectionSettings CellSelection="None" CellClickAction="SelectRow" ColumnSelection="None" RowSelection="Single"/> </igGrid:XamWebGrid.SelectionSettings>
and handle the SelectedRowsCollectionChanged event:
SelectedRowsCollectionChanged="itemsSummaryGrid_SelectedRowsCollectionChanged"
private void itemsSummaryGrid_SelectedRowsCollectionChanged(object sender, SelectionCollectionChangedEventArgs<SelectedRowsCollection> e) { if (e.NewSelectedItems.Count == 1) { Messenger.Default.Send<ItemEntity>((ItemEntity)e.NewSelectedItems[0].Data); } }
Instead of RelayCommand in MVVM Light toolkit, I use Messenger to send the selected item.
I have the exact same values for the SelectionSettings. But, my XamGrid still doesn't seem to select the row. It's still recognizing cell selection. Are there any other properties in XamGrid that could override these attributes?
Hi,
Those are all the settings you need.
Can you attach a sample of this behavior not working?
-SteveZ