标准格式与UltragridCells中的自定义格式 [英] Standard formatting Vs Custom formatting in UltragridCells
问题描述
我正在尝试使用以下代码格式化 Ultragridcell
,并且可以正常工作。
I'm trying to format a Ultragridcell
using the following code and it works fine.
//代码
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;
但是当我尝试以格式
//代码
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.
对此需要咨询。
推荐答案
似乎您认为MaskInput属性支持复合格式,但我认为这是不正确的。
据我所知,MaskInput 可用的格式仅限于 UltraGrid设计器
提供的这些。
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
.
使用 UltraGrid设计器
(在UltraGrid控件上单击鼠标右键,选择UltraGrid Designer)在 Data Schema
上单击并定义一个数据模式,其中的一列将为DateTime列。然后转到波段和列设置
节点,选择列,然后选择定义为DateTime的列。在属性窗口中,您可以找到MaskInput属性及其允许的值。您可以尝试使用预定义的遮罩进行试验,并检查是否有符合您要求的遮罩。
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.
正如我所说的那样,我想这是真的。我不知道是否还有其他高级模式可以在设计时或运行时设置这些属性。如果来自Infragistics的某人想要在此答案中添加一些内容,将受到欢迎
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
这篇关于标准格式与UltragridCells中的自定义格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!