GridView.RowCellClick Event

Fires when a user clicks a data cell. If data is editable and the ColumnViewOptionsBehavior.EditorShowMode property equals MouseDown (or Default, if multiple row selection is disabled), the event is suppressed.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v20.1.dll


public event RowCellClickEventHandler RowCellClick
Public Event RowCellClick As RowCellClickEventHandler

Event Data

The RowCellClick event's data class is RowCellClickEventArgs. The following properties provide information specific to this event:

Property Description
Button Gets which mouse button was pressed. Inherited from MouseEventArgs.
CellValue Gets the edit value of the clicked cell.
Clicks Gets the number of times the mouse button was pressed and released. Inherited from MouseEventArgs.
Column Gets the column that contains the clicked cell.
Delta Gets a signed count of the number of detents the mouse wheel has rotated, multiplied by the WHEEL_DELTA constant. A detent is one notch of the mouse wheel. Inherited from MouseEventArgs.
Handled Gets or sets whether this event should be forwarded to the control's parent container. Inherited from HandledMouseEventArgs.
HitInfo Gets an object that identifies the clicked element. Inherited from RowClickEventArgs.
IsHMouseWheel This member supports the internal infrastructure, and is not intended to be used directly from your code. Inherited from DXMouseEventArgs.
IsMouseEvent Gets whether these event arguments provide data for the MouseUp, MouseDown, and MouseMove events. Inherited from DXMouseEventArgs.
Location Gets the location of the mouse during the generating mouse event. Inherited from MouseEventArgs.
RowHandle Gets the handle of the clicked row. Inherited from RowClickEventArgs.
X Gets the x-coordinate of the mouse during the generating mouse event. Inherited from MouseEventArgs.
Y Gets the y-coordinate of the mouse during the generating mouse event. Inherited from MouseEventArgs.


The RowCellClick event does not fire when a user clicks on a row cell if Grid data is editable and the ColumnViewOptionsBehavior.EditorShowMode property is set to MouseDown (or to Default, if multiple row selection is disabled).


The HitInfo parameter is not initialized when this event fires. Use the BaseView.CalcHitInfo method to get a HitInfo object.


In this example, the Data Grid is in non-editable mode (does not invoke cell editors when users click them). Cells under the "State" column cycle through all "ObjectState" enumerator values when a user clicks these cells.


using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid;

namespace DXApplication3
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        public Form1() {
            //add Data Grid
            GridControl gridControl = new GridControl { Parent = this, Dock = DockStyle.Fill };
            GridView gridView = new GridView();
            gridView.OptionsBehavior.Editable = false;
            gridControl.MainView = gridView;
            //bind to sample data
            List<SomeObject> dataSource = new List<SomeObject>();
            for (int i = 0; i < 4; i++)
                dataSource.Add(new SomeObject { Name = string.Format("Object{0}", i), State = (ObjectState)i });
            gridControl.DataSource = dataSource;

            gridView.RowCellClick += gridView_RowCellClick;

        //when a user clicks any "State" column cell, the cell should change its value
        void gridView_RowCellClick(object sender, RowCellClickEventArgs e) {
            if (e.Column.FieldName == "State") {
                ObjectState state = (ObjectState)e.CellValue;
                ObjectState newState;
                switch (state) {
                    case ObjectState.Normal:
                        newState = ObjectState.Selected;
                    case ObjectState.Selected:
                        newState = ObjectState.Highlighted;
                    case ObjectState.Highlighted:
                        newState = ObjectState.Hovered;
                        newState = ObjectState.Normal;
                GridView view = sender as GridView;
                view.SetRowCellValue(e.RowHandle, e.Column, newState);

        //sample data entity
        public class SomeObject {
            public string Name { get; set; }
            public ObjectState State { get; set; }

        //available values for the "State" column cells
        public enum ObjectState {
See Also