
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
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

Ves,
I am using the latest version of Telerik for Xamarin Forms and I can confirm that the bug is NOT fixed.
Regards,
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

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
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

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"...*
Thank you for sharing the workaround you've found.
Regards,
Yana
Progress Telerik