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

How to get the item on which the context menu was opened

1 Answer 89 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Fairoz
Top achievements
Rank 1
Fairoz asked on 16 Feb 2012, 07:41 AM

Hi,

Here is the issue. I have a radjumplist which is databound. The databinding is working fine and no problem with that. I got a context menu with two menus on it. I do NOT want to use commands and command binding. I just want to use the "tapped" event of the menuitems inside the context menu.

I am getting selected item as null from the jumplist. Perhaps its because the context menu is opened but the underlying item is not actually selected.

So, how can I get the object hence data (the bound object data) from the "tapped" event?

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 16 Feb 2012, 03:37 PM
Hi Tme,

Thank you for contacting us.

You can handle the Opening event of the context menu. In the event arguments there is the FocusedElement property which will give you the DataBoundListBoxItem instance that triggered the event. You can store this reference and use it upon the Tapped event of each item.

Something like this:

private void OnMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    this.openItem = e.FocusedElement as RadDataBoundListBoxItem;
}

I hope this helps. Let me know whether I can assist you in some other way.

Kind regards,
Georgi
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
ContextMenu
Asked by
Fairoz
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or