This is a migrated thread and some comments may be shown as answers.

fr-CA dateFormater

1 Answer 59 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Guillaume
Top achievements
Rank 1
Guillaume asked on 10 Jul 2015, 07:55 PM

Hi, I'm having a problem with the date format when I parse a date and its doesn't show the right date.

I set RadDatePicker Culture to fr-CA xaml side. and my application culture + cultureUI is set to fr-CA

I parse 03/07/2015 --> it shows 2015-03-07 = March 07 2015 it should be July 03 2015 (2015-07-03)

CodeSnipet Below.

<telerik:RadDatePicker  Grid.Column="1" Grid.Row="1"Style="{StaticResource leftRadDatePicker_style}"  Name="dateFacture"DateTimeWatermarkContent="{x:Static resources:Facture.DateWaterMark}"SelectedDate="{Binding DateFacture, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,NotifyOnValidationError=True}">  </telerik:RadDatePicker >

<Style TargetType="telerik:RadDatePicker" x:Key="leftRadDatePicker_style">
        <Setter Property="Height" Value="36" />
        <Setter Property="FontSize" Value="16" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="Culture" Value="fr-CA" />
        <Setter Property="Margin" Value="20,5,20,0" />
        <!--<Setter Property="Template" Value="{DynamicResource RadDatePickerControlTemplate}"/>-->
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <StackPanel>
                        <!-- Placeholder for the TextBox itself -->
                        <AdornedElementPlaceholder x:Name="textbox"/>
                        <TextBlock Text="{Binding [0].ErrorContent}" Style="{StaticResource ErrorText_style}" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsKeyboardFocusWithin" Value="True">
                <Setter Property="IsDropDownOpen" Value="True" />
            </Trigger>
        </Style.Triggers>
    </Style>
 

Thread.CurrentThread.CurrentCulture = new CultureInfo(ConfigurationManager.AppSettings["Culture"]);//Is fr-CA
 
Thread.CurrentThread.CurrentUICulture = new CultureInfo(ConfigurationManager.AppSettings["Culture"]);//Is fr-CA

 

 

 

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 13 Jul 2015, 12:52 PM
Hi Guillaume,

The observed by you behavior of RadDatePicker is an expected one as this is how the parser works in its current implementation. However, you could implement you own custom parsing logic that suits your needs using the ParseDateTimeValue event. Please check the following article from our help documentation that provides detailed information how to achieve this:
http://docs.telerik.com/devtools/wpf/controls/raddatetimepicker/how-to/implement-custom-parsing

Hopes this helps.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DatePicker
Asked by
Guillaume
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or