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
255
Select a row
posted

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.

Parents
No Data
Reply
  • 255
    Verified Answer
    posted

    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.

Children