My XAML is;
<telerikInput:RadCalendar x:Name="RunCalendar" Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="3" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" IsVisible="False" DisplayDate="{Binding CalendarDate}" MinDate="{Binding MinRunDate}" MaxDate="{Binding MaxRunDate}" SelectedDate="{Binding CalendarDate}" SelectionChanged="OnDateSelected" SelectionMode="Single" />
My code is;
private void OnCalendarClicked(object sender, EventArgs e){ CalendarDate = RunDate; RunCalendar.IsVisible = true;}private void OnDateSelected(object sender, ValueChangedEventArgs args){ DateTime newDate = DateTime.MinValue; try { newDate = DateTime.FromOADate(args.NewValue); } catch { //Ignore any error } DisplayRun(newDate);}
When OnCalendarClicked is run the CalendarDate is being set to "7/2/2019" (today's date) however the value for newDate in OnDateSelected (which runs immediately after) is "1/1/0001". However if I drill down into "args > base > NewValue" it is a DateTime value with the correct date.
How do I get the correct value for the date?