RadContextMenu error inside of RadDataGrid

5 posts, 0 answers
  1. Ryan
    Ryan avatar
    18 posts
    Member since:
    Oct 2010

    Posted 05 Jan 2011 Link to this post

    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.
  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 07 Jan 2011 Link to this post

    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
  3. DevCraft banner
  4. Jeff
    Jeff avatar
    2 posts
    Member since:
    Jan 2011

    Posted 25 May 2011 Link to this post

    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>

  5. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 27 May 2011 Link to this post

    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
  6. Jeff
    Jeff avatar
    2 posts
    Member since:
    Jan 2011

    Posted 27 May 2011 Link to this post

    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!
Back to Top
DevCraft banner