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
685
UltraCalendarCombo Question
posted

Hello,

I have a question regarding your CalendarCombo. I have a field in which I want to choose only the day and the month, not the year. I have used the Format property to show only day and month in the text area, but I dont want to see the year in the dropdown calendar (just the month). Is it possible?

Question number 2: I dont want the user can write in the text area, but choose the day only through the dropdown calendar. Is it possible?

 

Thank you

Claudio

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    mtgc said:
    I dont want to see the year in the dropdown calendar (just the month). Is it possible?

    Assign an instance of this class to the contorl's CreationFilter property:

    using nsMonthViewMulti = Infragistics.Win.UltraWinSchedule.MonthViewMulti;

    #region NoYearCreationFilter
    public class NoYearCreationFilter : IUIElementCreationFilter
    {

        #region IUIElementCreationFilter Members

        void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent)
        {
            nsMonthViewMulti.MonthHeaderAreaUIElement headerAreaElement =
                parent as nsMonthViewMulti.MonthHeaderAreaUIElement;

            if ( headerAreaElement != null )
            {
                TextUIElement textElement = headerAreaElement.GetDescendant( typeof(TextUIElement) ) as TextUIElement;
                if ( textElement != null )
                {
                    nsMonthViewMulti.VisibleMonth visibleMonth =
                        headerAreaElement.GetContext( typeof(nsMonthViewMulti.VisibleMonth) ) as
                        nsMonthViewMulti.VisibleMonth;

                    if ( visibleMonth != null && visibleMonth.Month != null )
                    {
                        int monthNumber = visibleMonth.Month.MonthNumber;
                        string monthName = visibleMonth.Month.CalendarInfo.MonthsOfYear[monthNumber].LongDescriptionResolved;
                        textElement.Text = monthName;
                    }
                }
            }
        }

        bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent)
        {
            return false;
        }

        #endregion
    }
    #endregion NoYearCreationFilter


    mtgc said:
    dont want the user can write in the text area, but choose the day only through the dropdown calendar. Is it possible?

    Handle the control's KeyPress event and set the 'Handled' property of the event arguments to true. This will prevent alpha-numeric keystrokes from being processed, while still allowing operational keys, i.e., navigational keys, F4, etc.

Children
No Data