繁体   English   中英

DevExpress Unbound列事件未触发,WinForms

[英]DevExpress Unbound column event not firing, WinForms

我创建了一个未绑定的列,打算使用计算的数据填充该列; 但是,我无法触发CustomUnboundColumnData事件。 我基本上从https://documentation.devexpress.com/#WindowsForms/CustomDocument1477上的 DevExpress文档中复制了代码

根据发现的其他帖子,我确保没有其他同名列。 新的未绑定列的确确实出现在网格中,但是该事件从未触发,所以我不知道如何填充它。

在我的构造函数中,我定义了以下列:(我确保没有其他同名列)

        GridColumn testColumn = new GridColumn();
        testColumn.FieldName = "Test Column1";
        testColumn.VisibleIndex = gridView1.Columns.Count;
        testColumn.UnboundType = DevExpress.Data.UnboundColumnType.DateTime;
        // Disable editing.
        testColumn.OptionsColumn.AllowEdit = true;
        // Specify format settings.
        testColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
        testColumn.DisplayFormat.FormatString = "d";
        testColumn.Visible = true;
        gridView1.Columns.Add(testColumn);

然后我有永远不会触发的事件函数

private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
    {
        MessageBox.Show("unbound column a go go");
  1. 如何填充未绑定的列?

解决了感谢DevExpress支持论坛(顺便说一句,非常好)

我错过了gridView1.CustomUnboundColumnData += gridView1_CustomUnboundColumnData;的行gridView1.CustomUnboundColumnData += gridView1_CustomUnboundColumnData; 告诉网格哪些事件处理程序用于未绑定的列

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM