【问题标题】:Standard formatting Vs Custom formatting in UltragridCellsUltragridCell 中的标准格式和自定义格式
【发布时间】:2013-06-26 05:49:25
【问题描述】:

我正在尝试使用以下代码格式化Ultragridcell,它工作正常。

//代码

            DefaultEditorOwnerSettings editorSettings;
            DateTimeEditor datetime_editor;
            editorSettings = new DefaultEditorOwnerSettings()
            editorSettings.DataType = typeof(DateTime);
            editorSettings.MaskInput = "mm/dd/yyyy";
            datetime_editor = new DateTimeEditor(new DefaultEditorOwner(editorSettings));
            e.Row.Cells["DateInfo"].Editor = datetime_editor;

但是当我尝试像下面的代码一样 format 时,它失败了。

//代码

            DefaultEditorOwnerSettings editorSettings;
            DateTimeEditor datetime_editor;
            editorSettings = new DefaultEditorOwnerSettings()
            editorSettings.DataType = typeof(DateTime);
            editorSettings.MaskInput = "D";
            datetime_editor = new DateTimeEditor(new DefaultEditorOwner(editorSettings));
            e.Row.Cells["DateInfo"].Editor = datetime_editor;

是否只有 custom formatting 也只有有限的类型适用于单元格,或者我在某个地方错了。

需要这方面的建议。

【问题讨论】:

    标签: vb.net infragistics datetime-format ultrawingrid


    【解决方案1】:

    您似乎认为 MaskInput 属性支持Composite Formatting 提供的所有格式化功能,但我不认为这是真的。
    据我所知可用于 MaskInput 的格式仅限于 UltraGrid Designer 提供的格式。

    使用UltraGrid Designer(右键单击UltraGrid 控件,选择UltraGrid Designer)单击Data Schema 并定义一个数据模式,其中一列将是DateTime 列。然后转到Bands and Column Settings 节点,选择列,然后选择定义为日期时间的列。在属性窗口中,您可以找到 MaskInput 属性及其允许的值。您可以尝试使用预定义的掩码并检查是否有符合您要求的掩码。

    正如我所说的,我认为这是真的。我不知道是否有另一种高级模式可以在设计时或运行时设置这些属性。如果来自 Infragistics 的人想要在这个答案中添加一些东西,我们会欢迎

    【讨论】:

    • 是否可以从后面的代码中获取这些值?这样我就可以填充那些供用户选择一个。
    猜你喜欢
    • 2014-08-17
    • 1970-01-01
    • 2016-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多