在分组行获得焦点时,本示例展开已折叠的分组行,或者折叠已展开的分组行。
C# | 复制代码 |
---|
using DevExpress.XtraGrid.Views.Base;
private void gridView1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) {
if (gridView1.IsGroupRow(e.FocusedRowHandle)) {
bool expanded = gridView1.GetRowExpanded(e.FocusedRowHandle);
gridView1.SetRowExpanded(e.FocusedRowHandle, !expanded);
}
}
|
Visual Basic | 复制代码 |
---|
Imports DevExpress.XtraGrid.Views.Base
Private Sub GridView1_FocusedRowChanged(ByVal sender As System.Object, _
ByVal e As FocusedRowChangedEventArgs) Handles GridView1.FocusedRowChanged
If GridView1.IsGroupRow(e.FocusedRowHandle) Then
Dim expanded As Boolean = GridView1.GetRowExpanded(e.FocusedRowHandle)
GridView1.SetRowExpanded(e.FocusedRowHandle, Not expanded)
End If
End Sub
|