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

How set DateFormat for DatePickerEditorSettings?

7 Answers 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anton Samarin
Top achievements
Rank 1
Anton Samarin asked on 28 Apr 2009, 08:13 AM
Hello, 
How can i set format (for example dd/MM/yyyy) for DatePickerEditorSettings? 
 I don't want the format depended on the culture.
Don't found some property for it.

Could you help me?
Thanks.

7 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 28 Apr 2009, 11:50 AM
Hello Anton Samarin,

In order to achieve that, you need to set the RadDatePicker.Culture property. This is the control that is used by the editor. The date string that you see in the editor is determined from the property CultureInfo.DateTimeFormat.ShortDatePattern.

You have two options here. You can either find an existing CultureInfo that has the appropriate ShortDatePattern and use it.

Alternatively, you can create an entirely new CultureInfo and register it by using the CultureAndRegionInfoBuilder Class. However, you should be aware that in order to successfully register a new culture you will require administrative privileges.

Here is the XAML snippet that shows how to modify the RadDatePicker:

<Window x:Class="Ticket208508_CustomizeDatePicker.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Title="Window1" Height="300" Width="300"
    <Grid> 
        <Grid.Resources> 
            <Style TargetType="{x:Type telerik:RadDatePicker}"
                <Setter Property="Culture" Value="ru-RU" /> 
            </Style> 
        </Grid.Resources> 
        <telerik:RadGridView Name="grid"></telerik:RadGridView> 
    </Grid> 
</Window> 
 

This will target all RadDatePicker's that "live" on the grid.

I hope this helps.

Regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Anton Samarin
Top achievements
Rank 1
answered on 29 Apr 2009, 12:08 PM
Hello,
if i want use this way:
  
            <Style TargetType="{x:Type telerik:RadDatePicker}"
                <Setter Property="Culture" Value="ru-RU" /> 
            </Style> 

how to do that in the grid cell the date written in the same format? because this culture applay for editor, but then i exit from editMode, in the cell is written the date in the my PC CurrentCulture format. 


0
Rossen Hristov
Telerik team
answered on 29 Apr 2009, 12:54 PM
Hello Anton Samarin,

To modify the way data is presented in each cell, you need to specify the DataFormatString for the respective column:

<Window x:Class="Ticket208508_CustomizeDatePicker.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Title="Window1" Height="300" Width="300"
    <Grid> 
        <Grid.Resources> 
            <Style TargetType="{x:Type telerik:RadDatePicker}"
                <Setter Property="Culture" Value="ru-RU" /> 
            </Style> 
        </Grid.Resources> 
        <telerik:RadGridView Name="grid" AutoGenerateColumns="False"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn  
                    DataFormatString="{}{0:dd/MM/yyyy}" 
                    DataMemberBinding="{Binding Received}" /> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
    </Grid> 
</Window> 
 

I hope this helps.

Kind regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Anton Samarin
Top achievements
Rank 1
answered on 07 May 2009, 08:16 AM
Hello , Ross!
Your answers help me, thanks.

But i have another question:
For example, i have some columns in RadGrid, second column with DatePickerEditorSettings. Whet first cell is in editMode and i click TAB, i get in second cell (with DatePickerEditorSettings), but i can edit it, because it isn't in editMode. You have encountered such a case? Could you help me? I need after TABing edit cell with DatePickerEditorSettings.

Thanks
0
Rossen Hristov
Telerik team
answered on 08 May 2009, 04:38 PM
Hello Anton Samarin,

That is very strange. One of the examples can do this and it works correctly, but there maybe a bug which we have not identified.

Can you please examine the example and if it does not help you solve the problem, please send us a sample project that reproduces this behavior. We will investigate it and try to find what is going wrong. Thank you in advance.

Greetings,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Anton Samarin
Top achievements
Rank 1
answered on 13 May 2009, 06:52 AM
Hello, Ross!
It work good in your web demo, but i tested it in Launch the C# Examples Q1 2009  on my PC and this don't work too. 
Have you the opportunity to test it on local version? If you don't find problem, i create test project for this case.

Thanks.
0
Rossen Hristov
Telerik team
answered on 14 May 2009, 12:45 PM
Hi Anton Samarin,

It turns out that this is a problem with the RadDatePicker that is used as a cell editor. We will do our best to resolve this issue as soon as possible. Please, excuse us for the inconvenience.

Best wishes,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Anton Samarin
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Anton Samarin
Top achievements
Rank 1
Share this question
or