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:// ...
随机推荐
- 《Terraform 101 从入门到实践》 第二章 Providers插件管理
<Terraform 101 从入门到实践>这本小册在南瓜慢说官方网站和GitHub两个地方同步更新,书中的示例代码也是放在GitHub上,方便大家参考查看. 不怕出身低,行行出状元. 插 ...
- Nginx03 虚拟主机
1 虚拟主机 虚拟主机使用特殊的软硬件技术,把一台运行在因特网上的服务器主机分成一台台"虚拟"的主机,每一台虚拟主机都具有独立的域名,具有完整的Internet服务器(WWW.FT ...
- Zstack使用经验系列2-安装的存储配置
从上图读者应该能看出当初分配主存储和镜像存储时空间分配的是多么不合理,镜像空间不需要那么多.不过这时系统已经运行了近1年,很多云主机以及系统服务都搭好了,如果再重新分配空间是多么的麻烦! 所以开始为p ...
- Golang HTTP编程及源码解析
1.网络基础 基本TCP客户-服务器程序Socket编程流程如如下图所示. TCP服务器绑定到特定端口并阻塞监听客户端端连接, TCP客户端则通过IP+端口向服务器发起请求,客户-服务器建立连接之后就 ...
- 题解 P4163 [SCOI2007]排列
强烈谴责只有 125MB 的行为,然后我没删调试是个什么 SB... 闲话少说,切入正题-- 首先看到取余和数字是可以排列的,我们自然而然的想到了数位 dp,但是很显然这题不是的数位 dp 通常解决的 ...
- Prometheus安装部署(主体)
Prometheus安装部署 一,下载安装包并解压 下载地址:https://github.com/prometheus/prometheus/releases 因为服务器上下载速度太慢,所以可以提前 ...
- Hugging Face 每周速递: Space 支持创建模版应用、Hub 搜索功能增强、BioGPT-Large 还有更多
每一周,我们的同事都会向社区的成员们发布一些关于 Hugging Face 相关的更新,包括我们的产品和平台更新.社区活动.学习资源和内容更新.开源库和模型更新等,我们将其称之为「Hugging Ne ...
- 【大型软件开发】开发日志(五).net框架与C++的融合:CLR——C++调用C#的DLL
做什么? 先说一下场景,现在正在开发一个Qt ActiveServer,也就是用一个应用程序去向其他的组件暴露接口,以达到提供服务的目的. 然后新版的框架要提供大部分功能,也就是要重做大部分模块.现在 ...
- C语言学习--结构体指针
#include<stdio.h> #include<string.h> //结构体指针: 指针的类型为结构体 typedef struct nodeData { int a; ...
- java学习日记20230228-数据类型及加号运算
程序中+使用: 1.两侧是数值型,则相加: 2.一方为字符串,则拼接: 3.运算顺序从做到右: 数据类型 每一种数据都定义了明确的数据类型,在内存中分配了不同大小的内存空间: java数据类型 基本数 ...