Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
320
DateTime Format
posted

Hi,

 I am binding my Datagrid to a dataset which have a DateTime column where the strings have the format "dd/mm/yyyy hh:mm:ss ". I would like to format the cells to display the Date part only. I have tried using the DataType property

 DataType="System.DateTime"

 But get an error message saying can not find type DateTime.

I would prefer to not manipulate the dataset, would appreciate if someone could advice if it is possible to format the cells to display the date only

 Thanks

Niclas 

Parents
No Data
Reply
  • 2320
    posted

    I use the XamDateTimeEditor's mask. Or you could use a Converter but that requires code behind. If your original data is a DateTime type then XamDataGrid uses a XamDateTimeEditor automatically.

     

    <igData:Field Name="Date" Label="Date">
         <igData:Field.Settings>
             <igData:FieldSettings CellWidth="120" LabelWidth="120">
                 <igData:FieldSettings.EditorStyle>
                     <Style TargetType="{x:Type igEditors:XamDateTimeEditor}" >
                         <Style.Setters>
                             <Setter Property="Mask" Value="{}{date}"/>
                          </Style.Setters>
                      </Style>
                 </igData:FieldSettings.EditorStyle>
             </igData:FieldSettings>
         </igData:Field.Settings>
    </igData:Field>

     

Children