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

Date formatting in ScheduleView doesn't follow current thread culture

2 Answers 29 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
samy
Top achievements
Rank 1
samy asked on 15 Nov 2011, 11:20 AM
After setting eveything i can think about to french, i still have some bound values in custom tooltips and custom event windows showing up in an english format. How can i have the thread set in french.

Here's what i do in the initialization step of my Silverlight app
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr");
            Telerik.Windows.Controls.LocalizationManager.DefaultCulture = new System.Globalization.CultureInfo("fr");

Then i have a custom tooltip:

<DataTemplate x:Key="PlanificationTooltipTemplate">
            <Grid MaxWidth="300">
                <StackPanel >
                    <StackPanel Orientation="Horizontal" Margin="0, 0,15, 0">
                        <TextBlock Text="{Binding Subject}" FontWeight="Bold" TextWrapping="Wrap" />
                        <TextBlock FontWeight="Bold"><Run Text=" - ("/></TextBlock>
                        <TextBlock Text="{Binding Appointment.Planification.Prestation.Produit}" FontWeight="Bold" TextWrapping="Wrap" />
                        <TextBlock FontWeight="Bold"><Run Text=")"/></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock><Run Text="Client : "/></TextBlock>
                        <TextBlock Text="{Binding Appointment.Planification.Prestation.Client}" FontWeight="Bold" TextWrapping="Wrap" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock><Run Text="Site : "/></TextBlock>
                        <TextBlock Text="{Binding Appointment.Planification.Prestation.Site}" FontWeight="Bold" TextWrapping="Wrap" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Start, StringFormat=\{0:HH:mm\}}" TextWrapping="Wrap" />
                        <TextBlock><Run Text=" - "/></TextBlock>
                        <TextBlock Text="{Binding End, StringFormat=\{0:HH:mm\}}" TextWrapping="Wrap" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Visibility="{Binding Path=Appointment.Planification.PlanificationRecurrente, Converter={StaticResource BooleanToVisibilityConverter }}">
                        <Image x:Name="RecurrenceMark" Grid.Column="0" Margin="2 1 1 0" Width="10" Height="10" Visibility="{Binding Path=Appointment.Planification.PlanificationRecurrente, Converter={StaticResource BooleanToVisibilityConverter }}" HorizontalAlignment="Left" Source="{StaticResource AppointmentItem_Recurrence}" />
                        <TextBlock Text="{Binding  Appointment.Planification.PremiereRecurrence, StringFormat=\{0:d\}}" />
                        <TextBlock><Run Text=" au "/></TextBlock>
                        <TextBlock Text="{Binding  Appointment.Planification.DerniereRecurrence, StringFormat=\{0:d\}}" />
                    </StackPanel>
                </StackPanel>
            </Grid>
        </DataTemplate>
where the bound values PremiereRecurrence and DerniereRecurrence, both formatted with {0:d} display in mm/DD/YYYY instead of the french value DD/mm/YYYY.

What's the way to force a locale on the tooltip (i have the same problem with an custom edit window for Appointments)?

2 Answers, 1 is accepted

Sort by
0
samy
Top achievements
Rank 1
answered on 18 Nov 2011, 12:01 PM
Any idea? i could force the date to display with the right format but i'd rather rely on the current culture i'm working on.
0
Yana
Telerik team
answered on 18 Nov 2011, 01:38 PM
Hello Samy,

I am afraid that you need to set these format strings in XAML. The other option is to use a Converter and convert the dates according to the set Culture.


All the best,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ScheduleView
Asked by
samy
Top achievements
Rank 1
Answers by
samy
Top achievements
Rank 1
Yana
Telerik team
Share this question
or