Hi Renruofan,
Thank you for contacting Syncfusion support.
We have checked your query. You can get the IsSelectedRow property from dataRow of VirtualizingCellsControl as like below code.
Code Snippet: xaml
|
private void Button_Click(object sender, RoutedEventArgs e)
{
//Get the Current Row and Column index from the CurrentCellManager
var rowColumnIndex = this.datagrid.SelectionController.CurrentCellManager.CurrentRowColumnIndex;
var nodeEntry = datagrid.GetNodeEntry(rowColumnIndex.RowIndex);
if (!nodeEntry.IsRecords)
return;
var recordUnderMouse = nodeEntry as RecordEntry;
// Get the DataRow
var dataRow = this.datagrid.GetRowGenerator().Items.FirstOrDefault(row => (row.RowType != RowType.HeaderRow && (row.RowData as Person) == recordUnderMouse.Data as Person)) as DataRowBase;
//Get the IsSelectedRow property from dataRow
var isSelected = dataRow.IsSelectedRow;
// To display the selected row first name
if (isSelected && (dataRow.Element is VirtualizingCellsControl))
MessageBox.Show((dataRow.RowData as Person).FirstName);
} |
Please find the sample from the below link and let us know if this helps you.
Please let us know if you have any other questions.
Regards,
Muthukumar K