GridControl

 

隐藏Drag a column header here to group by that column

https://www.devexpress.com/Support/Center/Question/Details/Q412390

I have created a Grid Control to view the Currency table. As there are only ten records in the table, can I hide the "Drag a column header here to group by that column" bar for the Grid Control.

 

To achieve this goal disable the GridView.OptionsView.ShowGroupPanel option.

 

添加或者删除行

https://documentation.devexpress.com/#WindowsForms/CustomDocument752

 https://www.devexpress.com/Support/Center/Question/Details/T195251

Please accept my apologies for providing the incorrect information.

The grid can't operate without a data source.

However, you're able to create an empty DataTable (without rows) that has only columns.

Look at the following code:

DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("Name", typeof(string));
gridControl1.DataSource = dt;

 

需要注意的是,手动添加了GridColumn的话,需要指定FiledName属性,要和DataTable中的列名保持一致。

 

设置时间格式,

https://www.devexpress.com/Support/Center/Question/Details/Q360794

To accomplish this task, set the GridColumn.DisplayFormat.FormatType property to the FormatType.DateTime value 

 

禁止编辑

gridView1.OptionsBehavior.Editable = false;

 

某一列的单元格显示图片

 设置GridColumn的ColumnEdit为PictureEdit,设置UnboundType为Object

 

private DevExpress.XtraEditors.Repository.RepositoryItemPictureEdit repositoryItemPictureEdit1;

设置repositoryItemPictureEdit1的图片显示

 

 

某一个单元格的单击事件

https://www.devexpress.com/Support/Center/Question/Details/Q406257

To accomplish this task, use the GridView.RowCellClick event.

Please note that this event will not fire when clicking on a row cell, if data editing is enabled and the ColumnViewOptionsBehavior.EditorShowMode property is set to MouseDown (and to Default, if multiple row selection is disabled). To accomplish this task, set the GridView.OptionsBehavior.EditorShowMode property to the EditorShowMode.MouseUp value.

 private void gridView1_RowCellClick(object sender, RowCellClickEventArgs e)
        {
            if (e.Column == gridColumn3)
            {
                //需要弹出对应行的场景配置详情
                Console.WriteLine($@"第{e.RowHandle + 1},第{e.Column.ColumnHandle}列");
            }
        }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值