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

Calendar highlighting months that have data associated with them

2 Answers 42 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 20 Jun 2014, 02:36 PM
Hi,

I am trying to  use the DatePicker control but I've not found a way yet to fix the following problem

1.  I need to show a calendar control that only shows months (this bits easy)
2.  I have a collection of dates.  I wish to highlight the month on the datepicker if that month appears in the collection of dates I have.

So it should be fairly straightforward.  A calendar that only shows months and bound to a list of dates.  If I have 01/01/14 in the list then Jan should be highlighted along with any other months that appear in the list (so maybe Jan, Mar, May would all be highlighted for 2014).

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Kalin
Telerik team
answered on 24 Jun 2014, 11:09 AM
Hi Craig,

I'll go straight to your questions:

1. In order to show only months you would need to set the DateSelectionMode of the DatePicker to Month.\
2. You can achieve the desired by implementing a custom MonthButtonStyleSelector in the CalendarStyle of the DatePicker. Using the selector you can return different Styles for the different month buttons depending on the present items in the DateTime collection you are using. For your convenience I have prepared a sample project which demonstrates the exact approach.

Hope this will work for you.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Craig
Top achievements
Rank 1
answered on 24 Jun 2014, 04:12 PM
Excellent - that is just what I needed.

Thanks for your help - really appreciated
Tags
DatePicker
Asked by
Craig
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Craig
Top achievements
Rank 1
Share this question
or