Pushpin - Menu - Open on MouseEnter

2 posts, 0 answers
  1. Jon
    Jon avatar
    539 posts
    Member since:
    Apr 2004

    Posted 24 Jun 2012 Link to this post

    I have a context menu on a pushpin. The user right clicks and brings up the menu (it works.. thanks to your help)
    How can I automatically bring up the menu when the user MouseEnter's and hide the menu when the MouseLeaves?
    The problem is that, most user will not know that they should right mouse click to bring the menu up.
    thanks in advance.
  2. Andrey
    Andrey avatar
    1681 posts

    Posted 28 Jun 2012 Link to this post

    Hello Jon,

    You can set the RadContextMenu.IsOpen property to true for showing the context menu like the following:
    private void OnPushpinMouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        this.contextMenu.PlacementTarget = sender as UIElement;
        this.contextMenu.IsOpen = true;

    But I can't recommend the behavior with using MouseEnter and MouseLeave events for opening context menu, because when the user is trying to use the context menu then the MouseLeave will occur on a pushpin. In this case the menu will be closed. You should implement a logic with using timeouts to close context menu after the MouseLeave occurs but when the context menu is not focused. Also you should handle the MouseLeave event on the context menu to close it when the user didn't click any item of context menu. The implementation of this code is out of the support scope of RadMap control. You should implement it by yourself.

    Kind regards,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top