Home Forums WPF controls Xceed DataGrid for WPF How to set datetime format from colomn

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24415 |

    I have a grid:

    <xcdg:DataGridControl …. >
    <xcdg:Column FieldName=”DueDate” Title=”Due Date” Width=”100″/>
    <xcdg:Column FieldName=”Title” Title=”Title” Width=”180″/>
    </xcdg:DataGridControl>

    On initialized:

    DataGrid.ItemsSource = DateTable;

    Colomn DueDate have DateTime type in DataBase

    how set datetime format?

    Imported from legacy forums. Posted by SkyFox (had 374 views)

    User (Old forums)
    Member
    Post count: 23064

    You can create a converter for your DataTime. Ex:
    <xcdg:Column
    FieldName=”DueDate”
    Title=”Due Date”
    Width=”100″
    DisplayMemberBinding=”{Binding Path=DueDate, Converter=DueDateConverter, ConverterParameter=DueDate}”/>
    In converter, convert your parameter to format that you want.
    Also, DataGrid converts the DateTime to short DateTime when binded to DataGridCollectionView or CollectionViewSource.
    Good luck! Lena

    Imported from legacy forums. Posted by Lena (had 2965 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.