Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1440
How to Disable Trailing Days in UltraMonthViewMulti
posted

The display of the calendar with Trailing Days selected will display (if the days fall correctly for the selected month and year) the days from the previous and next month greyed out.  Visually, the greyed out day numbers gives the impression that the day is disabled when in fact it is not.  How can I disable these days.  I've already discussed unchecking the Trailing Days option but the user wants the calendar to display them.

Thanks 

  • 69832
    Verified Answer
    Offline posted

    Assuming you are displaying only one month at a time, you could find the days that are being displayed that do not belong to that month, create a Day object for each one of them, and set the Enabled property to false. The control fires an event, VisibleMonthsChanged, when the user scrolls different months into view, so you could handle this event and enable the last month's days and disable the new one's.

    Note that disabling large numbers of days individually can cause a performance issue because when the user navigates around the days, the control has to know if a given day can be activated, and if it has a large number of disabled days to search through it takes more time to process the keystroke. For this reason you should make sure to re-enable the days after they go out of view if you go with this approach.