Hi
I would like the date format to be displayed as 04/JAN/2009
i tried the style setter for XamDateTimeEditor property = "Mask" and put the value as "dd/MMM/YYYY"
it is not working
any ideas on what should be done....?
There is also a StringFormat or Format property on Editor, which is for this purpose.
My understanding of mask is that it is constraining how user inputs, e.g. for a telephone mask such as (123)-456-7890, user can only types numbers inside of the ( )- - template.
Agreed that the mask would format the bound value, but based on the same logic shouldnt it format the value based on the type of input in the case datetime type and not as a string always...
Hi,
i found a solution for this problem of mine
We have to use a converter in the XamDataGrid.The Name of the converter is FieldToEditorConverter it has to be used in the following mannerput this tag in the page.resources<Page.Resources><local:FieldToEditorConverter x:Key="dateTimeValueConverter"/></Page.Resources> and the field(column) will have to be set like this<igDP:Field Name="Startdate" Label="Start Date" > <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamDateTimeEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamDateTimeEditor}"> <Setter Property="ValueToDisplayTextConverter" Value="{StaticResource dateTimeValueConverter}"/> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
/***** Converter ***********/
Public Class FieldToEditorConverter Implements IValueConverter Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert If value IsNot Nothing AndAlso TypeOf value Is DateTime Then Dim dtmDate As DateTime = DirectCast(value, DateTime) Return (dtmDate.ToString("dd/MMM/yyyy")) Else Return (String.Empty) End If End Function Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack If value IsNot Nothing AndAlso TypeOf value Is String Then Return DateTime.Parse(DirectCast(value, String)) Else Return Nothing End If End FunctionEnd Class
Actually a bit surprised with that .
i tried a work around of changing the format of the property( of datetime type ofcourse) bound to the field but that didnt help either, nothing showed up in that cell.
Anyways thanks for replying.
To the best of my knowledge, displaying this format 01/Jan/2009 is not possible. You can see all the default masks for the XamEditors in this topic in the help.
Regards,
Alex.
Hello guys,
isnt there a way to do this ? i 'm sure there would be.....
Waiting for a reply....