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.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的更多相关文章
- Dev GridView RowCellClick活动MouseDown事件
GridView可编辑.在无声的思想左键点击"进入编辑". 将GridView的OptionsColumn.AllowEdit至false离开时触发RowCellClick. 但有 ...
- Dev GridView RowCellClick事件与MouseDown事件
GridView处于可编辑状态,左键点击默认为“进入编辑”. 将GridView的OptionsColumn.AllowEdit设置为false后左键可触发RowCellClick.但有时候,既希望G ...
- DevExpress GridView.CustomSummaryCalculate 实现自定义Group Summary
--首发于博客园, 转载请保留链接 博客原文 DevExpress Documentation官方地址:GridView.CustomSummaryCalculate Event 1. 概要 界面上 ...
- devexpress GridControl 行指示列图标绘制
Row Indicator Panel The row indicator panel represents a region displayed at the left edge of the Vi ...
- Android中使用GridView和ImageViewSwitcher实现电子相册简单功能
我们在手机上查看相册时,首先看到的是网格状的图片展示界面,然后我们选择想要欣赏的照片点击进入,这样就可以全屏观看该照片,并且可以通过左右滑动来切换照片.如下图的显示效果: 首先我们先罗列一下本次实现所 ...
- js操作做GridView
一:获取当前选中行的数据 function fun_selectedInfo() { //获取当前鼠标选中元素 var e=event.srcElement; //获取当前元素所在行号 var row ...
- 扩展GridView控件——为内容项添加拖放及分组功能
引言 相信大家对GridView都不陌生,是非常有用的控件,用于平铺有序的显示多个内容项.打开任何WinRT应用或者是微软合作商的网站,都会在APP中发现GridView的使用.“Tiles”提供了一 ...
- Android开发学习之路-下拉刷新以及GridView的使用
GridView是类似于ListView的控件,只是GridView可以使用多个列来呈现内容,而ListView是以行为单位,所以用法上是差不多的. 主布局文件,因为要做下拉刷新,所以加了一个Prog ...
- 实现gridview空白处的点击事件
今天做了一个girdview,要求长按item出现删除按钮,点击空白处取消,长按出现按钮可以,但是点击空白处有问题,如果点击到书籍的空白处 可以用适配器的布局点击事件处理,但是空白区域不是item,不 ...
- js获取gridview模板列中textbox行列的值
下面一个例子:在gridview中第一列输入数值,第二列输入数值,点击第三列的时候进行计算 求和,如果不符合标记为红色字体. 如图: 代码 : <html xmlns="http:// ...
随机推荐
- SQL Case条件判断SQL
问题描述:在表中取到一些值做出判断,配合监控监测一些表中的数据.使用select case when if 来做条件查询判断 CASE 表达式遍历条件并在满足第一个条件时返回一个值(类似于 if-th ...
- Pytest插件pytest-repeat重复执行
Pytest插件pytest-repeat重复执行 安装 pip install pytest-repeat doc https://pypi.org/project/pytest-repeat/ h ...
- vue+element 返回数组或json数据自定义某列显示的处理--两种方法
本文是作者开发一个业务需求时,将返回数据列表的其中一个数据长度很长的字段处理成数组,并将其作为子表显示的过程,具体样式如下(数据做了马赛克处理) 返回的过长字段数据处理(用分号分隔的一个长字段): t ...
- Tesseract图片文字识别
如何进行图文识别? 百度api收费的,自己训练模型集费时费力,有没有训练好的库,我们拿过来直接用的呢? 有,那就是tesseract. 安装 pipenv install pytesseract pi ...
- slate源码解析(一)- 序言
笔者从大学时期就开始接触的前端,在刚去实习的时候就被导师安排去做内网的一个小富文本工具.之后从毕业后干的第一份工作游戏客户端,到现在做着可视化相关的前端工作,都有在做富文本相关的内容.可以说是和富文本 ...
- Solon2 之基础:一、常用应用配置说明
约定参考: //资源路径约定(不用配置:也不能配置) resources/app.yml( 或 app.properties ) #为应用配置文件 resources/WEB-INF/static/ ...
- Lucky Tree
题目:http://codeforces.com/problemset/problem/109/C 题意:一棵树n个节点,组成一个图,每条边都有权值,对于i.j.k三个数,计算所有的 i 到 j 和 ...
- 基于Ubuntu搭建OpenGL开发环境
1. 引言 笔者这里基于Ubuntu 20.04.3 LTS系统,搭建OpenGL开发环境,主要使用的库有GLFW和GLAD GLFW是一个专门针对OpenGL的C语言库,它提供了一些渲染物体所需的最 ...
- Spring Cloud Alibaba 整合 Seata 实现分布式事务
在Spring Boot单体服务中,添加@Transactional注解就能实现事务.在单体服务中,执行事务都是在同一个数据库下进行.但是随着业务越来越复杂,数据量越来越大会进行分库分表.在微服务场景 ...
- 仿 MVC 三大特性
1.先做个小例子 特性,只能通过反射实现 我们自定义一个特性 public class CustomAttribute : Attribute { public int Id; public stri ...