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

RadDatePicker

2 Answers 43 Views
DatePicker and DateSelector
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Eitan
Top achievements
Rank 1
Eitan asked on 06 Oct 2014, 02:39 AM
Hi,

Created a RadDatePicker in this way:

XAML:
<telerikInput:RadDatePicker x:Name="TelerikDatePicker"
    HorizontalAlignment="Center"
    VerticalAlignment="Center"
    Width="300" >
</telerikInput:RadDatePicker>

and C#:
    var cultureInfo = new CultureInfo( "he-IL" );
    cultureInfo.DateTimeFormat.Calendar = new HebrewCalendar();
    TelerikDatePicker.Culture = cultureInfo;

The behavior is shown in the attached 2 screenshots (Select a date in the Hebrew calendar and display the result as the equivalent Gregorian date):

I would like to do the opposite behavior, i.e. to have the user select a Gregorian date and display the result as the equivalent Hebrew date.

How can I do that?

Thanks,
Eitan
 



2 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 08 Oct 2014, 12:35 PM
Hello Eitan,

In this case I can suggest that you handle the RadDatePicker.ValueChanged event and change the RadDatePicker.ValueString property so that it matches your criteria. For example: 

private void TelerikDatePicker_ValueChanged(object sender, Telerik.Windows.Controls.ValueChangedEventArgs<object> args)
{
    var cultureInfo = new CultureInfo("he-IL");
    cultureInfo.DateTimeFormat.Calendar = new HebrewCalendar();
 
    DateTime date = (DateTime)args.NewValue;
    string stringValue = date.ToString("dd/MM/yyyy", cultureInfo);
    (sender as RadDatePicker).ValueString = stringValue ;
}

I hope this helps.

Regards,
Ivaylo Gergov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Charliedj
Top achievements
Rank 2
answered on 25 Feb 2016, 08:50 AM
set_selectedDate
get_selectedDate
Tags
DatePicker and DateSelector
Asked by
Eitan
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Charliedj
Top achievements
Rank 2
Share this question
or