This is a migrated thread and some comments may be shown as answers.

IsOpen not resetting, and custom PlacementMode

2 Answers 141 Views
RadialMenu
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 21 Jul 2017, 05:35 PM

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 Answers, 1 is accepted

Sort by
0
Ed
Top achievements
Rank 1
answered on 21 Jul 2017, 06:21 PM

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?

0
Kalin
Telerik team
answered on 26 Jul 2017, 11:53 AM
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.
Tags
RadialMenu
Asked by
Ed
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or