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

How to place keyboard-triggered RadContextMenu at Appointment

5 Answers 137 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Jochen
Top achievements
Rank 1
Jochen asked on 07 Aug 2015, 10:01 AM

Hello,

 I'm trying to get the RadContextMenu attached to the RadScheduleView to open at the currently selected slot, appointment or empty field using the Apps key (a.k.a. keyboard rightclick).

 

So far I've tried changing the PlacementTarget ​in the RadContextMenu's OnOpening event, but I can't find a way to get the actual source.

RadContextMenu.elementCausedContextMenuOpen is TimeLineRulerPanel, hence RadContextMenu.GetClickedElement<AppointmentItem>() returns null.

Placing the RadContextMenu at MousePoint is not an alternative as it could be anywhere within the application.

 

So is it event possible to get the current scheduler child control to place the ContextMenu at?

 

Thanks in advance!

Jochen

5 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 10 Aug 2015, 01:08 PM
Hi Jochen,

Please, check the following article from our help documentation that demonstrates how to achieve the desired functionality using the SelectedSlot and SelectedAppointment properties of RadScheduleView:
http://docs.telerik.com/devtools/wpf/controls/radscheduleview/howto/get-resource-from-clicked-slot.html

The approach described in the article demonstrates how depending on the clicked item of RadScheduleView to execute custom logic and get the Resource of the clicked Appointment or Slot.

Hopes this helps.

Regards,
Nasko
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Jochen
Top achievements
Rank 1
answered on 10 Aug 2015, 01:41 PM

Hi Nasko,

thanks for your reply, but that's not what I require.

 

Example:

Using rightclick on mouse (see first attached file): ContextMenu opens at MousePosition.

Using Key.App (see ​second attached file): ContextMenu opens at bottom left of ScheduleView.

 

So what I'd like to do when hitting the Apps key is to ​​position the ContextMenu right at the selected slot and not somewhere unrelated.

 

Cheers,

Jochen

0
Jochen
Top achievements
Rank 1
answered on 10 Aug 2015, 01:46 PM
[quote]Jochen said:

Example:

Using rightclick on mouse (see first attached file): ContextMenu opens at MousePosition.

Using Key.App (see ​second attached file): ContextMenu opens at bottom left of ScheduleView.  

[/quote]

Oh, attachments got sorted. Well, filenames speak for themselves I guess​

0
Accepted
Nasko
Telerik team
answered on 12 Aug 2015, 08:49 AM
Hi Jochen,

Thank you for the attached images. It really helped us a lot to better understand your scenario.

In order to achieve the desired behavior we suggest you to use the Opening event of the ContextMenu and the SelectedAppointment and SelectedSlot properties of RadScheduleView.

So, when the ContextMenu gets open the event will be fired. Inside it you need to check if there is a SelectedAppointment or SelectedSlot - they are mutually exclusive because of that while the one is set the other is null. If there is a SelectedAppointment you need to get all AppointmentItems using the ChildrenOfType method. Next you need to find which AppointmentItem is equal to the SelectedAppointment and set it as PlacementTarget for the ContextMenu.

If there is no SelectedAppointment there should be a SelectedSlot as explained above they are mutually exclusive. So, if there is SelectedSlot again using the ChildrenOfType property you need to get the HighlightedItems and set the PlacementTarget with the first found item.

We have created a sample project that demonstrates the described above approach and you could run and evaluate it.

Hopes this helps.

Regards,
Nasko
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Jochen
Top achievements
Rank 1
answered on 18 Aug 2015, 09:32 AM

Hi Nasko,

​Thank you very much for your detailed answer and the attached sample! That was what I was missing, works perfectly now.

 

Cheers,

Jochen

Tags
ScheduleView
Asked by
Jochen
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Jochen
Top achievements
Rank 1
Share this question
or