Home Forums WPF controls Xceed DataGrid for WPF DatePicker Edit Format

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

    Hello !!

    I have a wpf xceed grid with two datetime columns and the default datepicker editor only allows to edit the date in the format dd/MM/yyyy. My question is:

    ¿ How can I alter the edit format of the datepicker default editor to allow date edits with dd/MM/yyyy HH:mm:ss format ?

    Ej: I want to enter a date as 07/11/2007 08:20:00

    ¿ How can I do that ?

    Thanks in advance !!

    Imported from legacy forums. Posted by Miguel (had 6281 views)

    User (Old forums)
    Member
    Post count: 23064

    Set DateTimeMaskMode property of DatePicker to DateTimeMaskMode.ShortDateAndLongTime

    See the DateTimeMaskMode enumeration for all possible values.

    Hope this help,
    Liviu

    Imported from legacy forums. Posted by winnetou (had 469 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello !!

    thanks for the answer…but…I’m new to WPF and Xceed so…what steps do I have to take ?

    ¿ do i have to alter the DateTemplate of the default editor for datetime columns ?

    ¿ Can you show me an example ?

    Thanks !

    Imported from legacy forums. Posted by Miguel (had 362 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello !!

    I can’t find a DateTimeMaskFormat enumeration….¿ where is it ?

    Thanks!

    Imported from legacy forums. Posted by Miguel (had 997 views)

    User (Old forums)
    Member
    Post count: 23064

    How do you provide the grid columns?

    You have AutoCreateColumns property setted to true (this is default value)
    or you provide mannualy the columns collection?

    Liviu

    Imported from legacy forums. Posted by winnetou (had 404 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello !!

    Here’s my XAML Code:

    <dg:DataGridControl x:Name=”periodsGrid” >
    <dg:DataGridControl.Columns>
    <grid:Column FieldName=”PeriodId” Title=”ID”/>
    <grid:Column FieldName=”DateTimeIni” Title=”Start Date/Time” Width=”140″/>
    <grid:Column FieldName=”DateTimeEnd” Title=”End Date/Time” Width=”140″/>
    <grid:Column FieldName=”Comments” Title=”Comments”/>
    <grid:Column FieldName=”InvertedId” Visible=”False”/>
    </dg:DataGridControl.Columns>
    </dg:DataGridControl>

    Columns ‘DateTimeIni’ and ‘DateTimeEnd’ are both DateTime type based and the grid is bound to a SQLServer database.

    So … ¿ How can i edit and display dates in dd/mm/yyyy hh:mm:ss format ?
    and…
    ¿ How can I visualize dd/mm/yyyy hh:mm:ss format when the cell is not in edit mode ?

    Thanks !!

    Imported from legacy forums. Posted by Miguel (had 388 views)

    User (Old forums)
    Member
    Post count: 23064

    for a DateTime column set
    CellContentTemplate=”{StaticResource shortDateAndLongTimeCellDataTemplate}”

    where,
    <DataTemplate x:Key=”shortDateAndLongTimeCellDataTemplate”>
    <TextBlock Text=”{Binding Converter={StaticResource dateTimeToStringConverter}, ConverterParameter=’ShortDateAndLongTime’ }” />
    </DataTemplate>

    and

    <xcdg:DateTimeToStringConverter x:Key=”dateTimeToStringConverter” />

    are defined as resources.

    Liviu

    Imported from legacy forums. Posted by winnetou (had 1029 views)

    User (Old forums)
    Member
    Post count: 23064

    I am curious….

    How do you set the DatePicker.DateTimeMaskMode to ShortDateAndLongTime programmatically?

    For instance in my c# code I have this line…
    DataGridControl_Scheduler.Columns[“Start_Time”].CellEditor = ???
    How do you set it so that the DatePicker uses that Mask above?

    I assume this will show the little dialog calendar box with a place to edit the time?

    Imported from legacy forums. Posted by David (had 521 views)

    Xceed Support
    Member
    Post count: 5658

    You can trying creating an implicit style that targets DatePicker and that sets the DateTimeMaskMode property, or you can assign a new DatePicker to the CellEditor property that has the DateTimeMaskMode property set.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 7199 views)

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