Selected Date is Not Correct on iOS

8 posts, 0 answers
  1. Lama Chandrasena
    Lama Chandrasena avatar
    3 posts
    Member since:
    Jun 2010

    Posted 30 May 2015 Link to this post

    I have the following code:

        public class TestPage : ContentPage     {
            public TestPage () {
                var calendar = new RadCalendar () {  };
                calendar.SelectionChanged += async (object sender, Telerik.XamarinForms.Common.ValueChangedEventArgs<object> e) =>     {
                    var selectedDate = e.NewValue as DateTime?;
                    var culture = new CultureInfo("en-AU");
                    var title = string.Format("Options for {0}",selectedDate.Value.Date.ToString("d",culture));
                    var result = await this.DisplayActionSheet(title , "Cancel", null, "Option 1", "Option 2");
                };
                Content = calendar;
                Title = "Test";
            }
        }

    When I select a date on the calendar, the correct date is shown on the ActionSheet title on Android platform. On iOS platform, the date shown is the previous date.

    Is this a bug or am I doing something wrong? I need to display the selected date on my ActionSheet.

     

    Thanks.

  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 03 Jun 2015 Link to this post

    Hi Lama,

    Indeed, this is a bug. It is already fixed and the fix will be included in our next release, expected later this month.

    Best regards,
    Ves
    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
  3. Yordan
    Yordan avatar
    14 posts
    Member since:
    Jan 2013

    Posted 28 Jul 2015 in reply to Ves Link to this post

    Ves,

    I am using the latest version of Telerik for Xamarin Forms and I can confirm that the bug is NOT fixed.

    Regards,
    Mihail

  4. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 30 Jul 2015 Link to this post

    Hi Mihail,

    Please, find attached a small example which works fine on my end. Please, give it a try and let us know if it yields correct results for you. Please, confirm that the version you are using is 2015.2.721.143.

    If the issue still appears in your project, please open a formal support ticket and send us a sample, which reproduces it, so that we can investigate it and get back to you with our findings. Thank you.

    Best regards,
    Ves
    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
  5. Felipe
    Felipe avatar
    1 posts
    Member since:
    Aug 2012

    Posted 26 Feb 2018 in reply to Ves Link to this post

    Sorry for my english, i use mvvm prism. No work whe use binding (SelectedDate="{Binding SelectedDate, Mode=TwoWay}")

    If in my viewmodel i put

    _selecteddate = _maxdate;
    RaisePropertyChanged("SelectedDate");

     

    The gui no refresh

  6. Lance | Manager Technical Support
    Admin
    Lance | Manager Technical Support avatar
    1193 posts

    Posted 27 Feb 2018 Link to this post

    Hello Felipe,

    Please refer to the support ticket you have open for this issue for a full explaination.

    To summarize:

    Your TwoWay binding is working because when you set the SelectedDate to one of the days in the first week, you can see that cell is selected.  The problem is you're setting the Calendar's HeightRequest="100", thus you cant see the SelectedDate because the rest on the Month is cut off. 

    The solution is to give the Calendar enough room to render all of the days, when you can see the rest of the cells, you'll see they get selected as well.

    Regards,
    Lance | Tech Support Engineer, Sr.
    Progress 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
  7. Namysław
    Namysław avatar
    44 posts
    Member since:
    Jul 2017

    Posted 08 Mar 2018 Link to this post

    I'm facing most probably exact same issue, but already found workaround for that - in my XAML view code behind, I did tricky setting SelectedDate = null and then reverting it back. After that, SelectedDate is really selected in the UI:

    protected override void OnAppearing()
    {
        // TODO - Temporary workaround for Telerik issue at iOS - *SelectedDate* is not setting selection in UI, for Appearing of Calendar (setting/changing date works fine)
        // Workaround is to fill temporary *DateTime* object with *SelectedDate*, then setting *null* to *SelectedDate*, and then restoring original date back on *SelectedDate* (SIC!)
        if (Device.RuntimePlatform == Device.iOS && Calendar.SelectedDate != null)
        {
            var cachedDateTime = Calendar.SelectedDate.Value;
            Calendar.SelectedDate = null;
            Calendar.SelectedDate = cachedDateTime;
        }
     
        base.OnAppearing();
    }

    *Calendar* object above, is the *x:Name* of my RadCalendar in XAML - *<telerik:RadCalendar x:Name="Calendar"...*

  8. Yana
    Admin
    Yana avatar
    5042 posts

    Posted 12 Mar 2018 Link to this post

    Hi Namysław,

    Thank you for sharing the workaround you've found.

    Regards,
    Yana
    Progress 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
Back to Top