Hello, I was strugling to find out the way to set the format of MonthHeaderCaption of UltraCalendarCombo.
Currently it displays a format like January 2008, February 2008,... and so on.
How can I change the format of this to something like 1/2008, 2/2008, ... or Jan 2008, Feb 2008, ..... or January, February, ......?
Of course, it was easy to set the format of textbox by setting
UltraCalendarCombo1.Format = "MMMM dd"
However, I could not find any method to set the format of MonthHeader.
The control does not extend a way to customize the format of the header text because it displays the name of the month, whereas the format for the edit portion is applied to a specific date. By default, we obtain the names of the month from the current culture's DateTimeFormatInfo. The UltraCalendarInfo.DaysOfWeek collection provides a way to override the display names of each month (see LongDescription/ShortDescription properties of the DayOfWeek object).
The following code sample demonstrates how to solve the problem you describe here using the IUIElementCreationFilter interface:
using Infragistics.Win.UltraWinSchedule;using Infragistics.Win.UltraWinSchedule.MonthViewMulti;
/// <summary>/// Implements IUIElementCreationFilter for the purpose of customizing/// the header text for the UltraMonthViewMulti control./// </summary>public class MonthHeaderCreationFilter : IUIElementCreationFilter{ #region IUIElementCreationFilter Members
void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent) { MonthHeaderAreaUIElement headerElement = parent as MonthHeaderAreaUIElement; if ( headerElement != null ) { TextUIElement textElement = headerElement.GetDescendant( typeof(TextUIElement) ) as TextUIElement; if ( textElement != null ) { Month month = headerElement.GetContext( typeof(Month) ) as Month; if ( month != null ) { textElement.Text = string.Format( "{0}/{1}", month.MonthNumber, month.Year.YearNumber ); } } } }
bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent) { return false; }
#endregion}
Hello, I tried this code on UltraMonthViewMulti but it is not working.. month name is not changed from "January 2014" to "1/2014".. any other suggestions ?