Gray date date older than MinDate in WinForms MonthCalendar control
I am using controls MonthCalendar
in a Windows Forms Application. I want gray dates older than the MinDate control (or give the user a visual clue about which dates are invalid to select). The control has no property to get the expected behavior. I tried UltraDateTimeEditor
from Infragistics but it has the same problem (no property to set color / style for dates before MinDate).
How can I get what I want without having to code my own calendar control or doing too much low-level (i.e. custom)? Ideally, the solution should work on .Net framework 2.0, but if it needs 3.5, that's ok.
The MonthControl seems to already do what you are looking for. Setting the minDate property removes invalid days / years from the calendar, so they cannot be selected. Works in .NET 2.0 and 3.5.
Please be aware that I am using Windows Server 2008, so the visual styles for .NET controls may differ from your systems. Good luck!
source to share