Calendar highlighting months that have data associated with them

3 posts, 1 answers
  1. Craig
    Craig avatar
    2 posts
    Member since:
    Jun 2011

    Posted 20 Jun 2014 Link to this post


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


  2. Answer
    Kalin avatar
    1279 posts

    Posted 24 Jun 2014 Link to this post

    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.

    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.
  3. Craig
    Craig avatar
    2 posts
    Member since:
    Jun 2011

    Posted 24 Jun 2014 in reply to Kalin Link to this post

    Excellent - that is just what I needed.

    Thanks for your help - really appreciated
Back to Top