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
648
UltraMonthView Header Double-click Behavior
posted

In Outlook 2007, if you are in the calender month view and you double-click on a date, then the appointment form pops up. However, if you double-click on the date's header, the day view is displayed.

In the UltraMonthView, regardless of whether you click on the date or its header, the appointment form pops up. Is there any way to determine if the header has been double-clicked, or is there some workaround to get the same behavior as Outlook?

John

  • 69832
    Suggested Answer
    Offline posted

    That behavior was based on an older version of Outlook. The following code sample demonstrates how to work around it:

    using nsMonthViewSingle = Infragistics.Win.UltraWinSchedule.MonthViewSingle;

    this.ultraMonthViewSingle.MouseDoubleClick += new MouseEventHandler(ultraMonthViewSingle_MouseDoubleClick);

    void ultraMonthViewSingle_MouseDoubleClick(object sender, MouseEventArgs e)
    {
        UltraMonthViewSingle control = sender as UltraMonthViewSingle;
        UIElement controlElement = control != null ? control.UIElement : null;
        UIElement elementFromPoint = controlElement != null ? controlElement.ElementFromPoint(e.Location) : null;
        nsMonthViewSingle.DayNumberUIElement headerElement = null;
        nsMonthViewSingle.DayUIElement dayElement = null;

        while ( elementFromPoint != null )
        {
            headerElement = elementFromPoint as nsMonthViewSingle.DayNumberUIElement;
            if ( headerElement != null )
                break;

            dayElement = elementFromPoint as nsMonthViewSingle.DayUIElement;
            if ( dayElement != null )
                break;

            elementFromPoint = elementFromPoint.Parent;
        }

        if ( headerElement != null )
        {
            //  TODO: display DayView
        }
        else
        if ( dayElement != null )
        {
            Owner owner = control.OwnerDisplayStyle == OwnerDisplayStyle.Separate ? control.OwnerFromPoint( e.Location ) : null;
            control.CalendarInfo.DisplayAppointmentDialog( dayElement.Date, dayElement.Date, true, owner );
        }

    }