Good morning,
I have some problems while trying to display a datetime value in the grid.
I use a list of items (BindingList<items>) that is bound to the grid. No problem so far, everything works as expected.
The grid displays the datetime value as date, which seems to be the default behavior.I read in one of the posts that the following formatting condition can be used to display date and time:
{date} {time}
So far, so good. When I apply this condition to the column the correct mask is shown in the designer:__.__.____ __:__:__
Unfortunately when I start the application I get the date and time, but without any formatting at all:30032010092344
Could anybody please be so kind and tell me how to accomplish to display the datetime as mentioned?
Any help is kindly appreciated
best regards
Andy
Hi Mike,
setting the MaskDisplayMode to IncludeBoth did the job.Everything is now displayed as expected.
Thank's a lot for your support, I really appreciate it.
I'll give it a try and let you know what happened... after eastern of course ;)
thank you very much for your help and best regards
Hi Andy,
Try different setting for MaskDisplayMode and see if that helps. Setting it to IncludeLiterals or IncludeBoth should do it, I think. I was not able to duplicate the problem on my machine by setting all three values to Raw, but my column was not read-only so that's probably the distinction.
I have checked the properties you mentioned, here is the result:
MaskClipMode = RawMaskDataMode = RawMaskDisplayMode = RawMaskInput = {date} {time}Format = ''
I only played around a little bit with the Format property, but I never used both together (Format/MaskInput)
The object I bind as datasource is defined like that:
public
class MyItemList : BindingList<MyItem>
and the corresponding field in MyItem like that:
DateTime? changedWhen { get; set; }
I used a nullable DateTime for this, and the UltraGridDesigner recognizes it as System.Nullable`1[System.DateTime]which is perfectly ok.
The cells never switch to edit mode, because it is a read only list, that's where I thought the Format property could be a better place to set the format... unfortunately both didn't work for me.
Do you have any ideas where to look at?
I tried this out and it works fine for me. When I use a MaskInput of "{date} {time}", my DateTime column shows the data like this:
12/26/2018 01:45 AM
Are you setting any of the other mask properties on the column, like the MaskDisplayMode, MaskDataModeMode, MaskClipMode, or Format?
Format will override the Mask when the cell is not in edit mode, and MaskDisplayMode determines whether the mask shows the literals and padding when the cell is not in edit mode.