This is a migrated thread and some comments may be shown as answers.
Selected Date is Not Correct on iOS
7 Answers 55 Views
This is a migrated thread and some comments may be shown as answers.
Lama Chandrasena
Top achievements
Rank 1
Lama Chandrasena asked on 30 May 2015, 11:39 PM

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.

7 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 03 Jun 2015, 05:18 AM
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
0
Yordan
Top achievements
Rank 1
answered on 28 Jul 2015, 09:21 AM

Ves,

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

Regards,
Mihail

0
Ves
Telerik team
answered on 30 Jul 2015, 11:10 AM
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
0
Felipe
Top achievements
Rank 1
answered on 26 Feb 2018, 09:14 PM

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

0
Lance | Manager Technical Support
Telerik team
answered on 27 Feb 2018, 10:27 PM
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
0
Namysław
Top achievements
Rank 1
answered on 08 Mar 2018, 08:28 AM

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"...*

0
Yana
Telerik team
answered on 12 Mar 2018, 12:27 PM
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
Asked by
Lama Chandrasena
Top achievements
Rank 1
Answers by
Ves
Telerik team
Yordan
Top achievements
Rank 1
Felipe
Top achievements
Rank 1
Lance | Manager Technical Support
Telerik team
Namysław
Top achievements
Rank 1
Yana
Telerik team
Share this question
or