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

Thread is closed for posting
2 posts, 1 answers
  1. Fairoz
    Fairoz avatar
    11 posts
    Member since:
    Jul 2011

    Posted 16 Feb 2012 Link to this post


    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?

  2. Answer
    Georgi avatar
    296 posts

    Posted 16 Feb 2012 Link to this post

    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,
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top