IsOpen not resetting, and custom PlacementMode

3 posts, 0 answers
  1. Ed
    Ed avatar
    3 posts
    Member since:
    Jun 2017

    Posted 21 Jul Link to this post

    Hello, 2 questions about radialmenu.

    Q1: According to the documentation, all the PlacementModes will auto-adjust the location of the menu if any of it will be cut off by screen bounds. I'd like to know how, if possible, to disable this behavior, so it opens exactly how it was told to, ignoring screen bounds. An example would be great.

    Q2: I have a simple button that uses a RadialContextMenu, the RadialMenu sets "IsOpen=true" in XAML. The first click works great where the radialmenu is already open. However if I close the menu, then click the button again, it is always closed and I have to click the center button to open it.

    Code:

            <Button Height="40" Width="40" Grid.Row="0" Grid.Column="0">

                <telerik:RadRadialMenu.RadialContextMenu>
                    <telerik:RadRadialMenu PopupPlacement="Center" ShowEventName="Click" HideEventName="LostFocus" InnerRadiusFactor="0.0" InnerNavigationRadiusFactor=".8" OuterRadiusFactor="2" Width="200" Height="200" StartAngle="180" IsOpen="True">
                        <telerik:RadRadialMenuItem CanUserSelect="False" ContentSectorBackground="LightGreen" Header="Auto" GroupName="ModeGroup" Command="{Binding ChangeModeCommand}" CommandParameter="AutoModeView"/>
                        <telerik:RadRadialMenuItem CanUserSelect="False" ContentSectorBackground="LightGray" Header="Idle" GroupName="ModeGroup" Command="{Binding ChangeModeCommand}" CommandParameter="IdleModeView"/>
                        <telerik:RadRadialMenuItem CanUserSelect="False" ContentSectorBackground="LightPink" Header="Stop" GroupName="ModeGroup" Command="{Binding ChangeModeCommand}" CommandParameter="StopModeView" IsSelected="true"/>
                        <telerik:RadRadialMenuItem CanUserSelect="False" ContentSectorBackground="LightCyan" Header="Setup" GroupName="ModeGroup" Command="{Binding ChangeModeCommand}" CommandParameter="SetupModeView"/>
                        <telerik:RadRadialMenuItem CanUserSelect="False" ContentSectorBackground="LightCoral" Header="OEMSetup" GroupName="ModeGroup" Command="{Binding ChangeModeCommand}" CommandParameter="OEMSetupModeView"/>
                    </telerik:RadRadialMenu>
                </telerik:RadRadialMenu.RadialContextMenu>

            </Button>

     

    Also... any updates on having the radialmenuitems automatically fill the radialmenu? So when you only add 2 items it fills the white space, and so on?

     

    Thanks

  2. Ed
    Ed avatar
    3 posts
    Member since:
    Jun 2017

    Posted 21 Jul in reply to Ed Link to this post

    So I found the StaysOpenOnShow property and that handles my Q2. Still wondering about Q1.

     

    Also, when using a RadialContextMenu, it disappears fine when I set HideEventName="LostFocus". However, I'd like it to also disappear when the user clicks the center back/close button when it's open. Where can I hook that in?

  3. Kalin
    Admin
    Kalin avatar
    1279 posts

    Posted 26 Jul Link to this post

    Hello Ed,

    About Q1 the control is placed inside WPF Popup and it provides the boundary detection functionality - this behavior cannot be changed through RadRadialMenu.

    As for Q2 - this can be achieved by implementing custom RadialMenuCommand
    that hides the menu when closed:

    public class CustomCloseCommand : RadialMenuCommand
    {
        public CustomCloseCommand()
        {
            this.Id = CommandId.Close;
        }
     
        public override void Execute(object parameter)
        {
            base.Execute(parameter);
            RadialMenuCommands.Hide.Execute(null, this.Owner.TargetElement);
        }
     
        public override bool CanExecute(object parameter)
        {
            return true;
        }
    }

    Hope this helps.

    Regards,
    Kalin
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top