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

Right Click location

2 Answers 66 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Christie Admin
Top achievements
Rank 1
Christie Admin asked on 10 Feb 2014, 09:23 PM
Hi,

I'm using the WeekViewDefinition and I would like to determine when the user click using his mouse right button if he clicked on an appointment, an empty slot or in the header of a columns where the control display the date, is so, I need to know on whivh volumn he clicked.

Thank's
Alain

2 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 13 Feb 2014, 12:52 PM
Hi Alain,

We can get clicked item by subscribing to the MouseRightButtonUpEvent of the ScheduleView. Then in the handler you need to check whether the clicked element has parent of type AppointmentItem or GroupHeader if not you could check the ScheduleView MouseOverSlot property for the slot. Please try the following code snippet below (the ScheduleView is with x:Name="ScheduleView"):
public MainWindow()
{
    InitializeComponent();
    this.ScheduleView.AddHandler(UIElement.MouseRightButtonUpEvent, new MouseButtonEventHandler(MouseRightButtonUpEventHandler), true);
}
 
private void MouseRightButtonUpEventHandler(object sender, MouseButtonEventArgs e)
{
    if ((e.OriginalSource as UIElement).ParentOfType<AppointmentItem>() != null)
    {
        var app = (e.OriginalSource as UIElement).ParentOfType<AppointmentItem>();
        Debug.WriteLine("Appointment clicked " + app.Appointment.Subject);
    }
    else if ((e.OriginalSource as UIElement).ParentOfType<GroupHeader>() != null)
    {
        var groupHeader = (e.OriginalSource as UIElement).ParentOfType<GroupHeader>();
        Debug.WriteLine("GroupHeader clicked " + groupHeader.Content);
    }
    else
    {
        // Should be Slot.
        if (this.ScheduleView.MouseOverSlot != null)
        {
            var slot = this.ScheduleView.MouseOverSlot;
            Debug.WriteLine("Slot clicked " + slot.Start);
        }
    }
}

Hope this works for you.

Regards,
Kalin
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

0
Christie Admin
Top achievements
Rank 1
answered on 13 Feb 2014, 03:41 PM
Work great :)

Thank's
Tags
ScheduleView
Asked by
Christie Admin
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Christie Admin
Top achievements
Rank 1
Share this question
or