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

RadContextMenu error inside of RadDataGrid

4 Answers 62 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 05 Jan 2011, 04:38 PM
I've noticed an error when using a RadContextMenu inside of a RadDataGrid. I have a context menu that displays information based on which cell is clicked on. I have the "SaysOpen" property set to true. When I click on another cell to close the menu, if I then click on that cell again without moving my mouse, the context menu opens on the old cell with the old cell's information. Once I move my mouse it will then pick up the new information.

The issue is that if a user double clicks on a new cell, expecting the old menu to close and a new one to open, it obviously won't work as expected.

4 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 07 Jan 2011, 09:34 AM
Hi Ryan,

I'm unable to reproduce this issue. Please find the attached project simulating your scenario and let me know if there is difference with your case.

Waiting for your response.

Best wishes,
Hristo
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Jeff
Top achievements
Rank 1
answered on 25 May 2011, 08:18 PM
Hristo,

I have been experiencing some strange behavior with obtaining the column of the clicked cell for the context menu when I came across this post. Unfortunately, your example solution experiences the same problems. When I click on a cell that has an even number ("8") sometimes I get the menu to display "Even" and sometimes it displays "Odd". I am using Silverlight 4.

My project is quite large here at HP but the basic problem is that when I try to get the column for the cell that was clicked on I need to build the items in the context menu on-the-fly. I end up geting the context menu built for the column to the right of the one I am clicking on. This is also verified when debugging the code when using the following logic:

var cell = FlightGridContextMenu.GetClickedElement<GridViewCell>();
string colName = cell.Column.UniqueName;

FlightGridContextMenu is attached to a RadGridView as per Telerik examples:

<telerik:RadGridView>
.
.
<telerik:RadContextMenu.ContextMenu >
<telerik:RadContextMenu x:Name="FlightGridContextMenu" ItemTemplate="{StaticResource ContextMenuDataTemplate}" Opened="FlightGridContextMenu_Opened" ItemClick="FlightGridContextMenu_ItemClick" />
</telerik:RadContextMenu.ContextMenu>
</telerik:RadGridView>

0
Hristo
Telerik team
answered on 27 May 2011, 08:44 AM
Hi Jeff,

There are two  things that should be noted here.
First you should call GetClickedElement only in Opened event handler. In ItemClicked you will probably get different item because mouse position will be different.
So you should cache the local variable in Opened handler, use it in ItemClicked event and clean it in Closed event of RadContextMenu.
The second note is that your browser should not be zoomed (e.g. if should be at 100%). This is because we are using HitTest to get the element under mouse position but Silverlight have a bug and return different element when browser is zoomed. There is nothing we can do to workaround this problem. We have reported it to Microsoft and still waiting for a fix.

Let me know if this helps you.

Best wishes,
Hristo
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
0
Jeff
Top achievements
Rank 1
answered on 27 May 2011, 05:51 PM
Hi Hristo,

1. Yes, I forgot to indicate that I was performing this in the Opened event handler, as the Telerik documentation and examples indicate.

2. You are absolutely correct! The "default" seting for my browser (IE 9) was at 125% - and when I adjusted it to 100% the example you provided as well as our application works perfectly. I never saw this because I have the status bar turned off.

Thanks for your help with this mystery!
Tags
Menu
Asked by
Ryan
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or