This is a migrated thread and some comments may be shown as answers.

Get date from mouse point

2 Answers 46 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Kasper Schou
Top achievements
Rank 1
Kasper Schou asked on 08 Apr 2011, 01:17 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 14 Apr 2011, 09:24 AM
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
0
Kasper Schou
Top achievements
Rank 1
answered on 14 Apr 2011, 10:23 AM
Hi Yana,

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

Best regards,
Kasper Schou
Tags
Calendar
Asked by
Kasper Schou
Top achievements
Rank 1
Answers by
Yana
Telerik team
Kasper Schou
Top achievements
Rank 1
Share this question
or