我有一个 gridView,每个主行都有一个 1to1 的主从关系。当用户单击详细视图时,我想确保主行也被激活(在最左边的列中有激活的图标):
如果我用键盘导航主网格和细节网格,这很好用,但不能用鼠标。所以我写了以下代码来尝试解决这个问题,但它不起作用。此代码通过详细视图的点击事件触发:
GridView focusedView = gridView3.GridControl.FocusedView as GridView;
// get the currently selected row in the child view
int focusedRowHandle = focusedView.FocusedRowHandle;
// get the parentView's row handle that owns the child view
int sourceRowHandle = focusedView.SourceRowHandle;
GridView parentView = focusedView.ParentView as GridView;
parentView.BeginSelection();
parentView.SelectRow(sourceRowHandle);
parentView.EndSelection();
谁能让我知道我做错了什么?