如何通过鼠标右键单击 RadGridView 中的单元格?
以下代码不起作用:
private void RadGridView_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
// ... getting grid and cell
if (e.RightButton == MouseButtonState.Pressed)
{
grid.UnselectAll();
grid.CurrentCellInfo = new GridViewCellInfo(cell);
cell.IsCurrent = true;
cell.IsSelected = true;
}
}
这很奇怪,但选择行工作正常:
if (e.RightButton == MouseButtonState.Pressed)
{
grid.UnselectAll();
row.IsSelected = true;
row.IsCurrent = true;
}