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

Menu built in code behind doesnt activate with KeyboardNavigationSettings key

1 Answer 58 Views
Menu
This is a migrated thread and some comments may be shown as answers.
david
Top achievements
Rank 1
david asked on 10 Oct 2019, 03:17 PM

See the code below, the RadMenu1 ALT-M works but the RadMenu2 ALT-N does not? So I'm guessing we need to set the RadMenu2 RadMenu2.KeyboardNavigationSettings.FocusKey in the code behind but RadMenu2.KeyboardNavigationSettings.FocusKey="N" is an error, how do we set this property?

  <telerik:RadMenu ID="RadMenu1" runat="server" BorderWidth="1px"
                Style="z-index: 10; width: 100%; white-space: normal;" Skin="Silk"
                Font-Names="Verdana" Font-Size="X-Small" EnableRoundedCorners="True"
                EnableAriaSupport="True">
                <Items>
                    <telerik:RadMenuItem runat="server" AccessKey="1" Text="Unit 1">
                        <Items>
                            <telerik:RadMenuItem runat="server" AccessKey="O" Text="open">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" AccessKey="C" Text="Close">
                            </telerik:RadMenuItem>
                        </Items>
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem runat="server" AccessKey="2" Text="Unit 2">
                        <Items>
                            <telerik:RadMenuItem runat="server" AccessKey="A" Text="Lec A">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" AccessKey="B" Text="Lec B">
                            </telerik:RadMenuItem>
                        </Items>
                    </telerik:RadMenuItem>
                </Items>
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

                <KeyboardNavigationSettings CommandKey="Alt" FocusKey="M"></KeyboardNavigationSettings>
            </telerik:RadMenu>

            <telerik:RadMenu ID="RadMenu2" runat="server" Flow="Horizontal" BorderWidth="1px"
                Style="z-index: 10; width: 100%; white-space: normal;" Skin="Silk"
                Font-Names="Verdana" Font-Size="X-Small" EnableRoundedCorners="true" RenderMode="Lightweight"
                EnableAriaSupport="true">
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                <KeyboardNavigationSettings CommandKey="Alt" FocusKey="N"></KeyboardNavigationSettings>
            </telerik:RadMenu>

 

 protected void Page_Load(object sender, EventArgs e)
    {
        RadMenuItem m = new RadMenuItem();
        m.Text = "Menu 1";
        RadMenu2.Items.Add(m);
        m.Text = "Menu 2";
        RadMenu2.Items.Add(m);
        //RadMenu2.KeyboardNavigationSettings.FocusKey = "";
        //RadMenu2.KeyboardNavigationSettings.CommandKey = "Alt";
    }

1 Answer, 1 is accepted

Sort by
0
david
Top achievements
Rank 1
answered on 10 Oct 2019, 08:02 PM

solved

 

 RadMenu2.KeyboardNavigationSettings.FocusKey = KeyboardNavigationKey.N;
        RadMenu2.KeyboardNavigationSettings.CommandKey = KeyboardNavigationModifier.Alt;

Tags
Menu
Asked by
david
Top achievements
Rank 1
Answers by
david
Top achievements
Rank 1
Share this question
or