c# - 如何在 GridLookUpEdit 中隐藏零?

标签 c# devexpress

我通过 GridLookUpEdit 获得了表格。 DisplayMember 类型是 DateTime。因此,我将 GridLookUpEdit FormatType 设置为 DateTime,将 FormatString 设置为 "d"。但是当我在 GridLookUpEdit 中选择行时,所选值显示为零时间,如 15.04.2014 0:00:00。我怎样才能避免这种情况?

最佳答案

当您选择一个特定的单元格时,如果该单元格设置为 Editable,则会显示该单元格的编辑器。要使用特定的单元格编辑器,您必须添加以下代码行:

// aDateColumn is the column you want to format
// Custom mask
RepositoryItemTextEdit columnEdit = new RepositoryItemTextEdit();
columnEdit.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime;
columnEdit.Mask.EditMask = "d";

aDateColumn.ColumnEdit = columnEdit;

更多信息 here .

关于c# - 如何在 GridLookUpEdit 中隐藏零?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23086909/

相关文章:

c# - 这个导致我在 Excel 电子表格中看到绿色三角形的公式有什么问题?

c# - 将特定的 ISO8601 TimeSpan ("P2M2W5D") 转换为 C# TimeSpan

devexpress - 在 CodeRush 中查找键绑定(bind)定义

c# - 如何在运行时运行 Devexpress 报表设计器?

c# - 合并在 PDF 中多次使用的同一图像

c# - 这些关闭我的应用程序的方法有什么区别?

c# - 以编程方式清理 Windows 缩略图缓存