Is it possible to mark bold some dates in DateTimeEditors's calendar? Like paint all Saturdays and Sundays with red or bold? Can you disable dates after today to pick up?
The UltraDateTimeEditor uses a .NET MonthCalendar in its dropdown portion, so theoretically it should also provide all the features that the MonthCalendar does. I didn't see anything exposed that lets you access the MonthlyBoldedDates collection that's on MonthCalendar, though. What you can do is use reflection to get the calendar used in the dropdown and set those dates yourself, i.e.:
private void ultraDateTimeEditor1_AfterDropDown(object sender, EventArgs e){ DateTimeEditor editor = (DateTimeEditor)this.ultraDateTimeEditor1.Editor; PropertyInfo info = typeof(DateTimeEditor).GetProperty("MonthDropDown", BindingFlags.NonPublic | BindingFlags.Instance); MonthDropDown dd = info.GetValue(editor, null) as MonthDropDown; if (dd != null) dd.MonthlyBoldedDates = new DateTime[ { DateTime.Now.AddDays(-1) };}
Note that you have to do this in the AfterDropDown because the control disposes the calendar between dropdown operations. You can use the MonthlyBoldedDates, BoldedDates, or AnnuallyBoldedDates as necessary.
As for painting different dates different colors, I don't think this is possible with the .NET control, so I don't see any way to do it with the UltraDateTimeEditor either.
What do you mean about "Can you disable dates after today to pick up"? If you mean prevent users from selecting any date past today, you could simply set the MaxDate on the control.
-Matt
info always returns null. Are you sure DateTimeEditor has property MonthDropDown?
I tested this exact code in a sample project, so it at least exists in the version I tested (which was 8.2 I think). I'm fairly certain that internal property has been there for a while, though. You could call GetProperties() in the debugger just to see which properties are available to you. Just make sure that you using the BindingFlags that I specified in my code.
If you're using the AfterDropDown event handler, then I'm not sure why it's not working for you. You could try submitting an incident to Developer Support, but it's not always 100% that something like this would work due to the nature of reflection and the possibility of internal code to change, as this is not a supported feature.
using Infragistics.Win;using Infragistics.Win.UltraWinEditors;using System.Reflection;
Now info is not null and dd is not null but still - no bolded dates. May be I should call some method to apply new settings? Or probably bolded dates list reinitialized by Windows and my settings not applyed :(
What namespaces are you using? May be it is wrong because I qualified names not correctly. I checked GetProperties and nothing seems like "Month..." there.