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

Pushpin - Menu - Open on MouseEnter

1 Answer 56 Views
Map
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 24 Jun 2012, 12:41 PM
Hi..
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.

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 28 Jun 2012, 07:27 AM
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 >>

Tags
Map
Asked by
Jon
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or