I'm not sure if this is a bug or not, but when using an UnboundField for a DateTime and setting the XamDateTimeEditor's Mask property to {time} or even "hh:mm tt", it doesn't show what is expected but rather it seems to do "dd:" instead. That is, it puts the day value where the hours should be and it doesn't place anything where the minutes or AM/PM should be.
Setting the mask as {date} works fine.
However, if I set the UnboundField's EditAsType property to DateTime, it works as expected.
Hello,
I am not sure either whether this is a possible issue or not. By default the UnboundField's DataType property is string so I believe you have to specify that or EditAsType, EditorStyle. When you set one of these properties, the unbound field will generate the proper editor for this type. Do you experience the these issues when the editor is a XamDataTimeEditor (after you set EditAsType) or before setting this - the editor should a XamTextEditor?
Sorry for the late reply. Had a hectic week.
When using an Unbound field to display DateTime, I set the EditorStyle as:
Normal 0 false false false EN-AU X-NONE X-NONE MicrosoftInternetExplorer4
<Style x:Key="xDateEditorStyle" TargetType="{x:Type igEditors:XamDateTimeEditor}" >
<Style.Setters>
<Setter Property="Mask" Value="{}{time}"/>
</Style.Setters>
</Style>
Before setting DataType or EditAsType to DateTime:
Using the date 05/05/2009 12:15 PM as an example, the result is incorrectly shown as "05:"
However, if the mask is simply "{}{date}", then the result is correct - "05/05/2009"
If I do set DataType or EditAsType to DateTime, everything is correct. I can understand that UnboundField's default editor is XamTextEditor but then it doesn't make sense that the {date} mask would work. It's because of this that I'm wondering if it's a bug?
Had the same issue, got it working with your workaround (EditAsType)
Thanks for sharing!!!
I think this is expected. Here is why:
Before setting DataType, the UnboundField will interpret this as String and display the full time - the editor will be text editor. If you set EditAsType, the editor will change to datet time editor and will display the value correctly, if the mask it date. The XamDataTimeEditor cannot display the time portion of DateTime when it is in edit mode, which is what Mask {}{time} does.
Furthermore, if you try setting {}{time} mask on the bound field, you will get the same result - the editor will change to a Text Editor, as the time portion cannot be displayed in edit mode.
If you want to display the Time portion of the DateTime, it has to be done when the editor is not in EditMode - set the format property, like this:
<Setter Property="Format" Value="yyyy/mm/dd hh:mm:ss"/>