Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Calendar > Get date from mouse point

Answered Get date from mouse point

Feed from this thread
  • Kasper Schou avatar

    Posted on Apr 8, 2011 (permalink)

    Hi Telerik,

    I'm trying to retrieve the date of which I have right-clicked.
    How can I retrieve a date (in month view) from a given point in the calendar.

    Or if it is possible to have right-click also select the date would help me.

    What I'm trying to achieve is that I have added a context menu and need to display some checked menu items according to the date being right-clicked (not the selected date).

    Thanks in advance!
    Best regards,
    Kasper Schou

    Reply

  • Answer Yana Yana admin's avatar

    Posted on Apr 14, 2011 (permalink)

    Hello Kasper,

    I suggest you subscribe to Opened event of RadContextMenu and find the clicked CalendarButton in its handler like this:

    private void RadContextMenu_Opened(object sender, RoutedEventArgs e)
    {
        var calendarButton = (sender as RadContextMenu).GetClickedElement<CalendarButton>();
        if (calendarButton != null)
        {
            var calendarButtonContent = calendarButton.Content as CalendarButtonContent;
            if (calendarButtonContent != null)
            {
                var clickedDate = calendarButtonContent.Date;
     
            }
        }
    }

    You can find attached a simple example demonstrating the approach. Hope this helps.

    Regards,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Attached files

    Reply

  • Kasper Schou avatar

    Posted on Apr 14, 2011 (permalink)

    Hi Yana,

    Thanks for the help, this was just what I needed :)

    Best regards,
    Kasper Schou

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Calendar > Get date from mouse point
Related resources for "Get date from mouse point"

WPF Calendar Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]