[DevExpress] GridControl Enter Key Event

GridControl Enter Key Event

Dev Express는 ProcessGridKey 이벤트를 통해 Enter Key 이벤트를 추가할 수 있습니다. 다음 예제 자료와 같습니다.

private void gridControl_ProcessGridKey(object sender, KeyEventArgs e) {
    ColumnView view = (sender as GridControl).FocusedView as ColumnView;
    
    if (view == null) return;
    
    if (e.KeyCode == Keys.Enter && e.Control && view.Editable && view.SelectedRowsCount > 0) {    
        e.Handled = true;
        
        //Do        
    }
}
GridControl Enter Key Event

Column

컬럼 옵션 확인하기 (앱솔루트 인덱스)

// AbsoluteIndex
// 요약: Gets or sets the column's position within the View's column collection.
// 값: An integer value representing the zero-based column index within the collection.

view.Columns[view.FocusedColumn.AbsoluteIndex].OptionsColumn.AllowEdit

Row

로우는 RowHandle을 통해 현재 값에 접근할 수 있습니다.

댓글