Problem with RadialContextMenu Positioning

2 posts, 1 answers
  1. Eugenio
    Eugenio  avatar
    2 posts
    Member since:
    Nov 2013

    Posted 16 Feb 2015 Link to this post

    Hi,
      I've got a problem with the new RadialMenu. I'm trying to using it into a Grid object and open it with the option PopupPlacement="MousePoint".
       <Grid x:Name="myGrid">
            <telerik:RadRadialMenu.RadialContextMenu>
                <telerik:RadRadialMenu PopupPlacement="MousePoint" IsOpen="True" StaysOpenOnShow="True">
                    <telerik:RadRadialMenuItem>
                        <telerik:RadRadialMenuItem Header="Refresh" CommandParameter="REFRESH" />
                        <telerik:RadRadialMenuItem Header="Search" CommandParameter="SEARCH" ContentSectorBackground="LightBlue" />
                    </telerik:RadRadialMenuItem>
                </telerik:RadRadialMenu>
            </telerik:RadRadialMenu.RadialContextMenu>
            <Image Source="landscape.jpg" />
        </Grid>
    I've used the same algorithm used in the Demo for showing / hiding the ContextMenu:

    private void OnEditorMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
            {
                if (e.ClickCount == 1)
                {
                    var radialMenu = RadRadialMenu.GetRadialContextMenu(this.Editor);
                    var mousePoint = e.GetPosition(this.Editor as IInputElement);
                    radialMenu.PopupHorizontalOffset = mousePoint.X;
                    radialMenu.PopupVerticalOffset = mousePoint.Y;
                    RadialMenuCommands.Show.Execute(null, this.Editor);
                }
            }

    private void OnEditorMouseDown(object sender, MouseButtonEventArgs e)
            {
                if (e.ClickCount == 1)
                {
                    RadialMenuCommands.Hide.Execute(null, sender as IInputElement);
                }
            }
    For the first click everything is working fine and the RadialContextMenu is shown exactly centered with the Mouse Pointer but... after the second click the RadialContextMenu popup as it was PopupPlacement="Mouse".

    Is it a bug ?


    Thanks for the help



  2. Answer
    Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 17 Feb 2015 Link to this post

    Hello Eugenio,

    Indeed there was an issue with the PopupPlacement Mouse, that is already resolved. You can test the same scenario with the latest internal build where the fix is available. However if you use the approach from the example with the RichTextBox, you would need to use PopupPlacement="Relative" as in the example. For a simpler solution you can also use the ShowEventName and HideEventName properties as explained here.

    Hope this helps.

    Regards,
    Kalin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top