Get date from mouse point

3 posts, 1 answers
  1. Kasper Schou
    Kasper Schou avatar
    21 posts
    Member since:
    Jul 2009

    Posted 08 Apr 2011 Link to this post

    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
  2. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 14 Apr 2011 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Kasper Schou
    Kasper Schou avatar
    21 posts
    Member since:
    Jul 2009

    Posted 14 Apr 2011 Link to this post

    Hi Yana,

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

    Best regards,
    Kasper Schou
Back to Top