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.v19.1.dll

Syntax

C#: public event RowCellClickEventHandler RowCellClick

VB: event Public RowCellClick As RowCellClickEventHandler

Event Data

The event handler receives an argument of type RowCellClickEventArgs containing data related to this event.

The following RowCellClickEventArgs properties provide information specific to this event.

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

Remarks

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.

Example

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() {
            InitializeComponent();
            //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;
                        break;
                    case ObjectState.Selected:
                        newState = ObjectState.Highlighted;
                        break;
                    case ObjectState.Highlighted:
                        newState = ObjectState.Hovered;
                        break;
                    default:
                        newState = ObjectState.Normal;
                        break;
                }
                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 {
            Normal,
            Selected,
            Highlighted,
            Hovered
        }
    }
}

GridView.RowCellClick Event的更多相关文章

  1. Dev GridView RowCellClick活动MouseDown事件

    GridView可编辑.在无声的思想左键点击"进入编辑". 将GridView的OptionsColumn.AllowEdit至false离开时触发RowCellClick. 但有 ...

  2. Dev GridView RowCellClick事件与MouseDown事件

    GridView处于可编辑状态,左键点击默认为“进入编辑”. 将GridView的OptionsColumn.AllowEdit设置为false后左键可触发RowCellClick.但有时候,既希望G ...

  3. DevExpress GridView.CustomSummaryCalculate 实现自定义Group Summary

    --首发于博客园, 转载请保留链接  博客原文 DevExpress Documentation官方地址:GridView.CustomSummaryCalculate Event 1. 概要 界面上 ...

  4. devexpress GridControl 行指示列图标绘制

    Row Indicator Panel The row indicator panel represents a region displayed at the left edge of the Vi ...

  5. Android中使用GridView和ImageViewSwitcher实现电子相册简单功能

    我们在手机上查看相册时,首先看到的是网格状的图片展示界面,然后我们选择想要欣赏的照片点击进入,这样就可以全屏观看该照片,并且可以通过左右滑动来切换照片.如下图的显示效果: 首先我们先罗列一下本次实现所 ...

  6. js操作做GridView

    一:获取当前选中行的数据 function fun_selectedInfo() { //获取当前鼠标选中元素 var e=event.srcElement; //获取当前元素所在行号 var row ...

  7. 扩展GridView控件——为内容项添加拖放及分组功能

    引言 相信大家对GridView都不陌生,是非常有用的控件,用于平铺有序的显示多个内容项.打开任何WinRT应用或者是微软合作商的网站,都会在APP中发现GridView的使用.“Tiles”提供了一 ...

  8. Android开发学习之路-下拉刷新以及GridView的使用

    GridView是类似于ListView的控件,只是GridView可以使用多个列来呈现内容,而ListView是以行为单位,所以用法上是差不多的. 主布局文件,因为要做下拉刷新,所以加了一个Prog ...

  9. 实现gridview空白处的点击事件

    今天做了一个girdview,要求长按item出现删除按钮,点击空白处取消,长按出现按钮可以,但是点击空白处有问题,如果点击到书籍的空白处 可以用适配器的布局点击事件处理,但是空白区域不是item,不 ...

  10. js获取gridview模板列中textbox行列的值

    下面一个例子:在gridview中第一列输入数值,第二列输入数值,点击第三列的时候进行计算 求和,如果不符合标记为红色字体. 如图: 代码 : <html xmlns="http:// ...

随机推荐

  1. drf-day5——反序列化类校验部分源码分析、断言、drf请求、drf响应、视图组件及两个视图基类、基于GenericAPIView+5个视图扩展类

    目录 一.反序列化类校验部分源码解析(了解) 二.断言 三.drf之请求 3.1 Request能够解析的前端传入的编码格式 3.2 Request类有哪些属性和方法(学过) 常用参数 Respons ...

  2. React组件渲染触发的条件-归纳总结

    一.React组件何时发生渲染--何时会生成React元素? React组件的渲染发生在两个阶段. 1. 组件挂载. 2. 组件更新. 二.React组件更新的触发条件是什么? 对没有实现should ...

  3. drf-三大认证源码分析、基于APIView编写分页、异常处理

    1.权限源码分析 1.APIView源码497行:self.initial(request, *args, **kwargs)中进行了三大认证. 2.在initial的源码中,以下三行代码是进行三大认 ...

  4. "万字" Java I/O 详解

    Java I/O流讲解 每博一文案 谁让你读了这么多书,又知道了双水村以外还有一个大世界,如果从小你就在这个天地里,日出而作,日落而息. 那你现在就会和众乡亲抱同一理想:经过几年的辛劳,像大哥一样娶个 ...

  5. axios设置全局headers

    需求:每次请求的时候都设置token为headers非常不方便 axios提供配置全局headers 这里我主要使用的是加 一个token验证 Global axios defaults axios. ...

  6. 【Windows】ip地址修改器v5.0.5.4 修改ip更简便

    ip地址修改器v5.0.5.4 修改ip更简便 IP地址修改器,一款能够快速的切换IP地址,在几个不同的固定IP之间进行切换,手动输太麻烦,所以可以用到这款IP地址修改器! 下载 ip地址修改器v5. ...

  7. Node版本管理工具 - Nvm的下载、安装配置与使用

    1.业务背景 不同时期的项目使用的Node版本也不一样,随着版本的更新一直在使用的Node版本也在不断升级,本文介绍一个Node版本的管理工具,可自由切换版本. 2.Nvm下载与安装 1)下载 下载地 ...

  8. 微信小程序分类菜单激活状态跟随列表滚动自动切换

    这里主要用到微信小程序提供的SelectorQuery获取页面节点信息实现,组件用的是微信小程序的scroll-view 逻辑就是获取右侧盒子的节点信息,获取右侧子分类的节点信息,当子分类滑动到顶部的 ...

  9. dataset的基本使用

    在折线图(柱状.散点图类似)中使用 案例一(默认方式) let option={ dataset:{ source:[ ["1","2","3&quo ...

  10. SpringBoot集成Tomcat服务

    目录 一.Tomcat集成 1.依赖层级 2.自动化配置 二.Tomcat架构 三.Tomcat配置 1.基础配置 2.属性配置类 3.配置加载分析 四.周期管理方法 1.控制类 2.核心方法 五.参 ...