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
435
Data Grid Record Selection
posted

When you click on any part of the row in the data grid, I want the 'record' to become selected.

So I tried

 <igDP:XamDataGrid.FieldLayoutSettings>

<igDP:FieldLayoutSettings

SelectionTypeCell="None"

SelectionTypeRecord="Extended" />

</igDP:XamDataGrid.FieldLayoutSettings>

This disables the 'Cell' selection.  When you click on a cell, it looks like the whole row (record) is selected, but no SelectedItemsChanged event is fired (for either the record or the cell).  And extended selection ('shift' and 'ctrl') does nothing (only one row is highlighted).

So I thought that maybe I could mark the record as selected (in code) whenever a 'Cell' selected event fired. So I tried:

 <igDP:XamDataGrid.FieldLayoutSettings>

<igDP:FieldLayoutSettings

SelectionTypeCell="Extended"

SelectionTypeRecord="Extended" />

</igDP:XamDataGrid.FieldLayoutSettings>

 

private void ResultSetDataGrid_SelectedItemsChanged(object sender, SelectedItemsChangedEventArgs e)

{

if (e.Type == typeof(Cell))

{

foreach (Cell cell in this.ResultSetDataGrid.SelectedItems.Cells)

{

cell.Record.IsSelected =
true;

}

}

}

But this causes exceptions, so it is obviously not a good way to proceed.

 Any other ideas?

Thanks,

Robson

Parents
No Data
Reply
  • 910
    Verified Answer
    posted

    Im doing the same thing on my Grid.

    I want the Cell Select to act like a row select.

    You can do it in the Xaml or in the C# using the FieldSettings.

    this.DataGrid.FieldSettings.CellClickAction = CellClickAction.SelectRecord;

Children