RadContextMenu.GetClickedElement(

18 posts, 0 answers
  1. Priya Iyer
    Priya Iyer avatar
    15 posts
    Member since:
    Apr 2010

    Posted 27 Jul 2010 Link to this post

     

     

    private void RadContextMenuOpportunities_Opened(object sender, RoutedEventArgs e)

     

    {

     

     

     

    RadTreeViewItem item = radContextMenuOpportunities.GetClickedElement<RadTreeViewItem>();

     

     

     

     

    if(item!=null)

     

    {

    CreatePageOppMainItemTab(item);

    }

    }


    I have ContextMenu within the tree. When I right click and open a menu item I'm not getting proper item. But I'm getting another RadTreeViewItem in same tree.

    Is this the way to get clicked TreeViewItem?

    RadTreeViewItem item = radContextMenuOpportunities.GetClickedElement<RadTreeViewItem>();


    Thanks!

    Priyastha

     

  2. Viktor Tsvetkov
    Admin
    Viktor Tsvetkov avatar
    382 posts

    Posted 28 Jul 2010 Link to this post

    Hi Priya Iyer,

    This is the way to get the clicked item so could you please send us your sample project so I will be able to investigate your problem.

    On a side note, I'd like to inform you that we've just released an online tool that allows you to reduce the size of your Silverlight applications. For more information, please visit http://blogs.telerik.com/blogs/posts/10-06-10/telerik_assembly_minifier.aspx

    Greetings,
    Viktor Tsvetkov
    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
  3. DevCraft banner
  4. Wiktor
    Wiktor avatar
    11 posts
    Member since:
    Sep 2010

    Posted 22 Nov 2010 Link to this post

    Hi,
    I have the same problem with RadGridView. In maybe 5-10% of the cases when I right-click on a row, a wrong row is returned by RadContextMenu.GetClickedElement<GridViewRow>(). To make it happen I just keep clicking on different rows, and eventually a random row is returned by GetClickedElement().

    This is the code I have:
     
    private void GridViewContextMenu_Opened(object sender, RoutedEventArgs e) 
    {
      var row = ((RadContextMenu)sender).GetClickedElement<GridViewRow>(); 
      RadContextMenu contextMenu = sender as RadContextMenu;
      if (row == null)  
      {
         contextMenu.IsOpen = false
      }
      else 
      {
         row.IsSelected = true
      }

     

     

     

    <telerik:RadGridView
      <telerik:RadContextMenu.ContextMenu>  
        <telerik:RadContextMenu Opened="GridViewContextMenu_Opened">
          <telerik:RadMenuItem Header="Edit" Click="EditMenuItem_Click"/> 
        </telerik:RadContextMenu>   
      </telerik:RadContextMenu.ContextMenu>
    ...
    </telerik:RadGridView

     

     

     

    Best regards,
    Wiktor

  5. Viktor Tsvetkov
    Admin
    Viktor Tsvetkov avatar
    382 posts

    Posted 23 Nov 2010 Link to this post

    Hello Wiktor,

    I was not able to reproduce your issue. Could you please examine the attached sample project and modify it if I am missing something and could you please make a screencast of the undesired behavior?

    Best wishes,
    Viktor Tsvetkov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  6. Wiktor
    Wiktor avatar
    11 posts
    Member since:
    Sep 2010

    Posted 23 Nov 2010 Link to this post

    Hi Viktor,
    I can reproduce the result without making any changes to your project. However, the behavior is visible only when clicking on cells with text, and when I change IE zoom to 125%.

     

    http://www.screencast.com/t/dwF14FCk

    Best regards,
    Wiktor
  7. Viktor Tsvetkov
    Admin
    Viktor Tsvetkov avatar
    382 posts

    Posted 26 Nov 2010 Link to this post

    Hello Wiktor,

    I can confrim that this is a bug, so I have logged it in our PITS under the name "ContextMenu: GetClickedElement does not return the correct element" and it will be ready for tracking and voting tomorrow the latest. I have updated your Telerik account.

    Kind regards,
    Viktor Tsvetkov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  8. Paul Brun
    Paul Brun avatar
    41 posts
    Member since:
    May 2010

    Posted 29 Nov 2010 Link to this post

    I can observe this issue when using the RadContextMenu within a TreeView, however, we are not setting the Browser Zoom level. Simply using the default.

    It also appears after right-clicking the item to open the context menu, left clicking on another item doesn't appear change the selected item and if we were to apply an IsExpanded property on the element we thought we left-clicked, it would expand the previously selected right-clicked item.

    Thoughts?

    paul
  9. Viktor Tsvetkov
    Admin
    Viktor Tsvetkov avatar
    382 posts

    Posted 30 Nov 2010 Link to this post

    Hi Paul Brun,

    Could you please send us a sample project that reproduces the problem?

    Sincerely yours,
    Viktor Tsvetkov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  10. Giancarlo Aguilera
    Giancarlo Aguilera avatar
    22 posts
    Member since:
    Nov 2006

    Posted 12 Apr 2011 Link to this post

    Hello Victor from Telerik,

    I was wondering if this problem has been resolved. We are using version 2010.3.1314.1040. I ask because we are experiencing this problem. Thank you
  11. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 15 Apr 2011 Link to this post

    Hi Giancarlo,

    We recently made a few changes in this functionality, that might be related to this problem. I would recommend trying the upcoming service pack early next week and checking if the problem persists. I am not 100% sure, but the update might have been included in the internal build from this week (version 2011.1.411), so it is also worth checking.

    All the best,
    Valeri Hristov
    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
  12. Peran
    Peran avatar
    15 posts
    Member since:
    Sep 2010

    Posted 27 Jun 2011 Link to this post

    Hi Valeri,

    I have updated to version 2011.1.627.1040 and I still have an issue with a context menu on a RadGridView.

    When the application is running with browser zoom (IE9 115%) GetClickedElement returns the incorrect row.

    I cannot find an issue in PITS for this.


    Regards

    Peran
  13. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 28 Jun 2011 Link to this post

    Hello Peran,

    GetClickedElement internally use VisualTreeHelper.FindElementsInHostCoordinates method.
    Unfortunately FindElementsInHostCoordinates have a bug when browser is zoomed and does not return the real element (but the element which is over if the browser is at 100%).
    We have reported it to Microsoft but there is still no fix.
    Sorry for the caused inconvenience.

    Kind regards,
    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
  14. Peran
    Peran avatar
    15 posts
    Member since:
    Sep 2010

    Posted 10 Jul 2011 Link to this post

    Hi Hristo,

    Is there a link to the issue at Microsoft? If there is I would like to vote for it to be fixed.

    As a work around, do you know how I could:

    1) Check the browser zoom level at application start up.
    2) Monitor for browser zoom changes whilst the application is running.
    3) Get my application to automatically change the browser zoom back to 100%.


    Thanks

    Peran

  15. Peran
    Peran avatar
    15 posts
    Member since:
    Sep 2010

    Posted 19 Jul 2011 Link to this post

    The work around is to add this to Application_Startup, preventing the browser zoom level impacting the silverlight app:

    Host.Settings.EnableAutoZoom = false;
  16. John Gartee
    John Gartee avatar
    7 posts
    Member since:
    Mar 2004

    Posted 02 Nov 2011 Link to this post

    As a behavioral update to this bug, I have noticed the following:

    Using IE 8, no zoom, default settings.

    If you right-click to invoke the context menu anyware above the middle of the header of the treenode, I seem to get the correct node returned on my call to GetClickedElement().  If I right-click on the bottom half of the tree node headter, the call returns the next node in the tree (the one below the desired node).

    I have not tested this for other behaviors, but it appears to point to there simply being a bug in the code that calculates the element at the right-click mouse position...perhaps using the center of the element as the determination of the target?  I cannot say if this is isolated to VisualTreeHelper.FindElementsInHostCoordinates (by your comment, I assume this is a Microsoft routine) or just in the telerik code.  Are they sure they are sending in the appropriate Point?

    Just a thought...


    Just my two cents. 
  17. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 03 Nov 2011 Link to this post

    Hi John,

    We were unable to reproduce this issue. I've tested your scenario using Q2 2011 SP1.
    Could you please send us sample project so that we can reproduce it?

    Greetings,
    Hristo
    the Telerik team

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

  18. Fredy
    Fredy avatar
    7 posts
    Member since:
    Mar 2012

    Posted 30 Jan 2014 in reply to Hristo Link to this post

    Hi, I have this problem in radgridview
    1. select a cell
    2. Do right Click in any other cell, return the selected cell:

    (Attach image)

    return m_gridContextMenu.GetClickedElement<GridViewRow>();
  19. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 05 Feb 2014 Link to this post

    Hello Fredy,

    I did not manage to reproduce the displayed in the screenshot issue with the latest Q3 2013 SP2 release of UI for Silverlight.

    I would suggest that you take a look at the following help topic:
    http://www.telerik.com/help/silverlight/radcontextmenu-how-to-use-radcontextmenu-with-radgridview.html
    which explains in details how you can use RadGridView with RadContextMenu and if you still experience the issue, please send us a sample project where it can be replicated, so we to be able to research it further.

    Regards,
    Yana
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner