Hi,
Screenshots displaying the issue are attached.
The control in question is set to UseAppStyling = true and UseOsThemes = false
This is running under Windows 7 (but we get similar results under XP.)
In the Windows7Basic.png UltraDateTimeEditor is dropped down. The desktop "personalization" is "Windows 7 Basic.". As you can see, no formatting has been applied.
In the WindowsClassic.png the same control is dropped down. Desktop "personalization" is set to "Windows Classic". The control is formatted by the Year and Month are not visible. They are active, however, so it is likely that this is formatting issue - yellow text on the same yellow background.
Is there a way to format this correctly?
Thanks very much for your patience and effort on this. Had I done a better search for previous posts I would have found the discussion of this issue in 2009.
Thanks again,
Steve
Hi Steve,
I took another look at this and it's very confusing to keep track of all the variations.
First, there are two different styles for the MonthCalendar. The style you see when you run AppStylist is the older style. Microsoft updated this control with a newer style that uses the system themes at some point.
When you run AppStylist, you are always seeing the old style MonthCalendar, regardless of your system theme.
When you create a new project in Visual Studio, depending on the version, Microsoft adds a line of code to your Main method which enables Visual Styles.
Application.EnableVisualStyles();
AppStylist is not doing this, which is why you see the old-style MonthCalendar on the AppStylist canvas.
So between the different OS themes, and EnableVisualStyles, there are a huge range of combinations here to deal with.
When Visual Styles are enabled and you are running under a theme which supports them, there is nothing you can do. The Color properties of the MonthCalendar are ignored.
In the older style,things get more complicated.
In addition to BackColor and ForeColor, I noticed that there are two other properties on he MonthCalendar: TitleBackColor and TitleForeColor. These properties affect the Title area of the MonthCalendar which includes the Month and Year, and the scrollbuttons, but does NOT include the days of the week. But, for some unfathomable reason, the days of the week, which are not in the title area and are drawn on the area of the control that uses the control's BackColor are using the TitleAreaBackColor to draw their text.
This seems like it's pretty clearly a bug in the MonthCalendar. But again, there's nothing we can do about this, except report it to Microsoft. And since this only applies to the old style, I don't expect Microsoft will be fixing it any time soon.
Of course, none of this helps you get what you need here.
So my question at this point is.. what is your goal here?
If your goal is to ensure that the text in the date dropdown is always readable to your users, then it should be possible for you to modify the isl file to uses colors that will be readable in all cases. You just have to make sure that you use a TitleAreaBackColor that has sufficient contrast so that it displays correctly against the BackColor you are using and also the TitleAreaForeColor.
The down side of this approach is that some users will see the themed dropdown, which probably won't look very good since it won't match the rest of your application.
If you goal is to always have the date dropdown by styled and match the rest of your application, then you will have to use something other than the MonthCalendar. That means either using UltraCalendarCombo (which does not have masking capability) or creating your own editor. The latter probably sounds like a pretty daunting task, but it's really not that bad.
What you can do is use the UltraMaskEdit control, or even the UltraDateTimeEditor, and use the ButtonsRight collection to add a DropDownEditorButton with an UltraMonthViewMulti control on it. This will combine masking and a style-able calendar control. You will have to write a little code to handle the interaction between the two, but it's not a huge amount of code and we could probably whip up a sample for you if you need it.
To answer your question - No, there is no way to change the default editor for the column. At least not in v9.1. In later versions (10.1 and up, if I am not mistaken), I am pretty sure there is a way to do this by deriving a class from the UltraWinGrid and overriding a method. This was something we added when we implemented our GanttView control.
Sorry, but another question:
When a column in a WinGrid is specified as having a Date datatype, it automatically uses the UltraDateTimeEditor. As we have seen, this control is faulty and doesn't display appropriately. Is there a way to specify that the editor control used by this column is the UltraCalendarCombo. We have to do this or 1) not allow the column to have any kind of calendar control, which our users would find fairly peculiar or 2) not use appStyling for the entire grid, which would look rather strange, since we're using it everywhere else or 3) individually (manually) format the grid to look like it's been styled (as the other controls are) or 4)edit the .isl file that we're using in some way to eliminate any styling in regards to the UltraDateTimeEditor. The fourth option sounds like the best, but we're wondering what your thoughts are about this...
As usual, screenshots can be uploaded to clarify, but you probably don't need them by now.
Thanks again for your help
steve
Well, thanks for the effort, anyway.
Actually, I think what happens is that under "WindowsClassic" (and always under XP) the infragistics DateTimeEditor, using AppStyling, makes an attempt to format and fails. It's partially formatted but doesn't show the month and year (making it useless), whereas the Microsoft MonthCalendar (and, BTW, the Microsoft DateTimePicker) work fine. Under Windows7Basic the Microsoft controls (and the dropdown calendar portion of your control) ignore formatting entirely. Happily, the textbox and button portion of yours can be formatted under Windows7Basic.
If you'd like to see screenshots, I'd be glad to provide them. But, I suppose, it's easy enough for you to test these controls yourself...
Unfortunately (for us) we can't use the UltraCalendarCombo because of its lack of an input mask. Hope that you will add that functionality sometime in the future.
We'll just have forget about AppStyling for the UltraDateTimeEditor controls...
Thanks again
Okay, I tried this out, and it looks like there's nothing we can do about it. The UltraDateTimeEditor is using the Microsoft MonthCalendar control as it's dropdown. When I use the "Windows 7 Basic" theme, no appearance properties work on this control.
You can try this out by placing a MonthCalendar on a Form and setting the BackColor property on it. the setting it ignored in the Windows 7 Basic theme.
When I switch to Windows Classic, the appearances work.
It seems like the control is using some sort of Windows 7 theming and ignoring all of the customization options, kind've like Windows Themes overrides the settings on the Infragistics control. The problem is, the MonthCalendar provides no way to turn off or override the themes like our controls do.
So I recommend switching to the UltraCalendarCombo control instead of UltraDateTimeEditor. The UltraCalendarCombo does not rely on any Microsoft controls, it's drawn entirely by Infragistics, so it's not subject to any of the MS control limitations.