RadDatePicker

3 posts, 0 answers
  1. Eitan
    Eitan avatar
    26 posts
    Member since:
    Jun 2012

    Posted 05 Oct 2014 Link to this post

    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. Ivaylo Gergov
    Admin
    Ivaylo Gergov avatar
    661 posts

    Posted 08 Oct 2014 Link to this post

    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.

     
  3. DevCraft banner
  4. Charliedj
    Charliedj avatar
    1 posts
    Member since:
    Feb 2016

    Posted 25 Feb Link to this post

    set_selectedDate
    get_selectedDate
Back to Top