Standard formatting Vs Custom formatting in UltragridCells

谁说我不能喝 提交于 2019-12-02 14:14:47

问题


I'm trying to format a Ultragridcell using the following code and it works fine.

//Code

            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;

But when I try to format like the below code, it fails.

//Code

            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;

Is that only the custom formatting that too only limited types works with the cell or i'm wrong somewhere.

Need an advice on this.


回答1:


It seems that you think that MaskInput property supports all the formatting functionality provided by Composite Formatting, but I don't think that it is true.
The formatting available for MaskInput as far as I know are limited to only these provided by the UltraGrid Designer.

Using the UltraGrid Designer (right click on the UltraGrid control, select UltraGrid Designer) click on the Data Schema and define a data schema in which one of the columns will be a DateTime column. Then go to the Bands and Column Settings node, select columns and then the column defined as DateTime. In the properties window you can find the MaskInput property and its allowed values. You could try to experiment with the predefined masks and check if there is one that fits your requirements.

As I have said this is what I suppose to be true. I don't know if there is another advanced mode to set these properties at design time or at Runtime. If, someone from Infragistics, wants to add something to this answer would be welcome



来源:https://stackoverflow.com/questions/17312414/standard-formatting-vs-custom-formatting-in-ultragridcells

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!