This is a migrated thread and some comments may be shown as answers.

Calendar not changing months with selected date

3 Answers 373 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
goodbar
Top achievements
Rank 2
goodbar asked on 28 Oct 2013, 02:49 AM

I have my RadCalendar for windows phone bound to a SelectedDate in my viewmodel and it updates back and forth just fine when the date changed is within the currently selected month, but if SelectedDate changes to a date in a month not already displayed on the calendar, the calendar does not change to that new month.  Is this a defect, or am I doing something wrong?



Here is my xaml:




<
telerikInput:RadCalendar AppointmentSource="{Binding}" SelectedValue="{Binding SelectedDate, Mode=TwoWay}"

MonthInfoDisplayMode="Small" WeekNumbersVisibility="Visible" DayNamesVisibility="Visible"/>

3 Answers, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 30 Oct 2013, 09:26 AM
Hello Joe,

Thank you for contacting us.

RadCalendar has a SelectedValue property which determines the date that is visualized as selected. However, this date is not necessarily part of the month that is currently visible. For example, if you tap on 31st of October, it will get selected. Then you can move to the next month, but this will not change the selection, unless you tap on another date. In order to programatically (or through data binding) change the month that is visible, you can use the DisplayDate property. When you change its value, the month that is currently visible will be changed accordingly. 

I hope this information helps. Let me know if you need further assistance.
 
Regards,
Todor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
goodbar
Top achievements
Rank 2
answered on 30 Oct 2013, 04:27 PM
Thank you, this worked; although, an error is generated if you are bound to a date with the default datetime of 1/1/0001, so in the viewmodel I handle this on my get and if the date.year == 1, then I return DateTime.Today otherwise, I return the actual selected datetime.
0
Todor
Telerik team
answered on 31 Oct 2013, 07:06 AM
Hi Joe,

I managed to reproduce the exception. It occurs when you get to the first month of the first year.
This happens because as you can see when the first date of a month is not on Monday, the calendar displays dates from the previous month.Since the 1st of January in year 1 is not on Monday, this results in an attempt to display dates that are not supported in .NET. We will try to fix this for some of our further releases, but for now your solution seems to be the best workaround.

I have updated your telerik points for reporting this issue.
 
Regards,
Todor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Calendar
Asked by
goodbar
Top achievements
Rank 2
Answers by
Todor
Telerik team
goodbar
Top achievements
Rank 2
Share this question
or