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

Open Context Menu on MouseMove over Selected Row in DataGrid

2 Answers 92 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 08 Oct 2010, 09:57 PM
Hi there,

 So there is a way to open Context menu on specific event. (http://www.telerik.com/help/silverlight/radcontextmenu-features-opening-on-specific-event.html) That is really useful.

Now I want to do the same but only if control is in focus. My example:

I have DataGrid control with it's own template. I also have DataGridRowTemplate in place. DataGridCellsPresenter have context menu. Right now I have EventName="MouseMove" I want to open context menu only if mouse move over selected row. Currently it will open context menu fo any row even if it is not selected.
                       <dataPrimitives:DataGridCellsPresenter x:Name="CellsPresenter" Grid.Column="1" dataPrimitives:DataGridFrozenGrid.IsFrozen="True">
                           <telerik:RadContextMenu.ContextMenu>
                               <telerik:RadContextMenu IconColumnWidth="36" ShowDelay="0:0:1" EventName="MouseMove"  >
                                   <telerik:RadMenuItem Header="Add/Edit Tag" Command="{Binding ContextMenuClick}" CommandParameter="Add/Edit" >
                                       <telerik:RadMenuItem.Icon>
                                           <Image Source="/Scorecard.Common.Silverlight.Controls;component/Resources/TagAdd.png" Stretch="Fill"/>
                                       </telerik:RadMenuItem.Icon>
                                   </telerik:RadMenuItem>
                                   <telerik:RadMenuItem Header="Remove Tag" Command="{Binding ContextMenuClick}" CommandParameter="Remove" >
                                       <telerik:RadMenuItem.Icon>
                                           <Image Source="/Scorecard.Common.Silverlight.Controls;component/Resources/TagRemove.png" Stretch="Fill"/>
                                       </telerik:RadMenuItem.Icon>
                                   </telerik:RadMenuItem>
                               </telerik:RadContextMenu>
                           </telerik:RadContextMenu.ContextMenu>
                       </dataPrimitives:DataGridCellsPresenter>

2 Answers, 1 is accepted

Sort by
0
Nick
Top achievements
Rank 1
answered on 13 Oct 2010, 06:23 PM
any suggestions?
0
George
Telerik team
answered on 14 Oct 2010, 11:51 AM
Hello Nick,

Unfortunately, you need a custom logic in order to accomplish this. There is no specific event that will be fired when the mouse moves over a selected element. I would suggest you to handle the MouseMove event and check is the row is selected. Then you can open the RadContextMenu.

I hope this helps.

All the best,
George
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Menu
Asked by
Nick
Top achievements
Rank 1
Answers by
Nick
Top achievements
Rank 1
George
Telerik team
Share this question
or