Position context menu

6 posts, 0 answers
  1. Rajesh
    Rajesh avatar
    25 posts
    Member since:
    Dec 2007

    Posted 19 Feb 2010 Link to this post

    Hi

    In one of my application, I am using Mind fusion diagramming control. This diagramming control allows user to add various shapes and lines. When the user clicks on shape or line small rectangle (adjustment handles) gets added dynamically on the main diagram control. I cannot use RadContextMenu.SetContextMenu function for these small rectanagles since they are created/destroyed by the diagram control.

    With there sub-classing behaviour, I know when user clicks on adjusment handle and raises the event. In this event, I want to show the popup. How I can achive this ?

    How one can set the mouse position where to display the popup and all other necessary information like which UIElement should be the parent of this context menu. 

    Regards
    Rajesh
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 24 Feb 2010 Link to this post

    Hi Rajesh,

    Thank you for contacting us.

    To use the ContextMenu on your elements, you can set it to the diagramming control. Set the EventName property of the ContextMenu to an empty string like so: EventName="".
    In the event that the element of the diagramming controls raises you can show the ContextMenu by setting IsOpen=true. You cannot change the UIElement, but in that event you can change the ItemsSource of the ContextMenu according to the figure the user has clicked.

    Hope that helps.

    If you have any other questions please feel free to contact us again.

    Greetings,
    Konstantina
    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. Rajesh
    Rajesh avatar
    25 posts
    Member since:
    Dec 2007

    Posted 25 Feb 2010 Link to this post

    Hi

    I am able to get the popup displayed but it is not at the correct location. It always gets displayed in upper left corner of the diagram element.

    -Rajesh
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 02 Mar 2010 Link to this post

    Hi Rajesh,

    Thank you for contacting us.

    Could you please open a support ticket and send us a sample project, which we can run here locally. In that way we will be able to provide you with the best solution.

    Looking forward to your reply.

    Regards,
    Konstantina
    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. Klaas van der Heijden
    Klaas van der Heijden avatar
    2 posts
    Member since:
    Feb 2009

    Posted 30 Jul 2013 Link to this post

     Hi,

     I have exact situation; I am using Mind fusion diagramming control. This diagramming control allows user to add various shapes and lines. I am using RadContextMenu to show menu items for lines and shapes. Menu Items are created at the run time based on clicked item [shape or line]. it shows the context menu correctly but not display on proper position.

    Below steps I have followed
    1.   public RadContextMenu contextMenu = new RadContextMenu() { EventName = "" };  
    2.   Create Menu List and added to contextMenu 
    3.   contextMenu.IsOpen = true;

    I have upgraded to 2013 [Version 2013.2.611.1050], before upgrade it works properly.

    how can I set the Mouse Position to context menu to display context menu at Mouse [right] clicked position?


    Thanks

  7. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 30 Jul 2013 Link to this post

    Hello Klaas,

    RadContextMenu has Placement, PlacementTarget and PlacementRectangle properties that you can use. When you open RadContextMenu via code by setting IsOpen=true, you have two options to control the position where the Popup will be:
    1) Set PlacementTarget property - for example you can set it to the current shape and RadContexMenu will be shown below it.
    2) Handle one of the mouse events on the control and set PlacementRectangle property. In order to get the position of the mouse, you'll need one of the mouse events (MouseLeftButtonDown, MouseLeftButtonUp, etc). In the event handler you can use the code below:
    Point mousePosition = e.GetPosition(null);
     
    this.ContextMenu.PlacementRectangle = new Rect(mousePosition.X, mousePosition.Y, 0, 0);
    this.ContextMenu.IsOpen = true;

    This will open the ContextMenu right below the mouse (as the PlacementRectangle has width=0 and height=0).

    I'm sending you a sample project to demonstrate this approach. Could you check it and inform us in case you have any problems or concerns.

    Regards,
    Rosen Vladimirov
    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