RadApplicationMenu orientation

6 posts, 0 answers
  1. Nhan Rao
    Nhan Rao avatar
    7 posts
    Member since:
    Sep 2009

    Posted 09 Dec 2009 Link to this post

    Is there any way to get the menu of the application menu to open horizontally to the right instead of vertically?  I tried setting the DropDownDirection to Right, but that doesn't seem to do anything.
  2. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 09 Dec 2009 Link to this post

    Hi Nhan,

    Thanks for contacting us and for the reported issue.

    I am not quite sure that I correctly understand the case, and I was not able to reproduce this issue. Setting DropDownDirection property works for me and the drop-down of RadApplicationMenu opens on the right side of the menu. Could you please give us more details on the case so that we can provide proper support?

    Also I would like to ask you to make sure that you are using the latest version of RadControls for WinForms (Q3 2009 SP1) since in this release there is a fix related to the popup direction of all drop-down controls like RadDropDownButton, RadApplicationMenu, RadMenu, etc.

    We look forward to receiving the requested details. Thanks for your time.

    Best wishes,
    Deyan
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Nhan Rao
    Nhan Rao avatar
    7 posts
    Member since:
    Sep 2009

    Posted 09 Dec 2009 Link to this post

    I want the initial menu items to be listed to the right of the application menu button instead of down underneath the button.  So, for example, instead of:

    File
    Tools
    Window
    Help

    I want:

    File Tools Window Help

    Then when you click on a menu item, the submenus open below them.  Any subsequent menu items will open to the right.  Essentially, I just want the behavior of the old style menus but have the menus only visible when you click on the application menu button.  Is this possible?  If it's not possible, is there a better solution to having the menus expand and contract?  I like not seeing the menus until I want to see them and not have them take up screen real estate, but my boss would rather have them open horizontally rather than vertically.  radApplicationMenu1.DropDownDirection = RadDirection.Right doesn't do that.
  5. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 14 Dec 2009 Link to this post

    Hello Nhan,

    Thanks for getting back to me and for the details on your case. The behavior you require is possible. However you cannot achieve it directly from Visual Studio designer but you have to use some code. Please take a look at the following code snippet:
    RadApplicationMenuDropDown ddForm = this.radApplicationMenu1.DropDownButtonElement.DropDownMenu as RadApplicationMenuDropDown;
               RadApplicationMenuContentElement contentElement = (ddForm.PopupElement as RadApplicationMenuDropDownElement).ContentElement.Layout.Children[0] as RadApplicationMenuContentElement;
               RadDropDownMenuElement menuElement = contentElement.Layout.Children[0] as RadDropDownMenuElement;
               menuElement.Layout.Orientation = Orientation.Horizontal;
               menuElement = contentElement.Layout.Children[1] as RadDropDownMenuElement;
               menuElement.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
               foreach (RadMenuItemBase menuItem in this.radApplicationMenu1.Items)
               {
                   if (menuItem.DropDown != null)
                   {
                       menuItem.PopupDirection = RadDirection.Down;
                       menuItem.Children[2].Children[2].Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
                   }
               }

    Basically, what I am doing is setting the orientation of the layout that holds the main menu items to Horizontal. I also hide the right part of the application menu and in the foreach loop set the PopupDirection of all items to Down so that they behave like a regular menu items.

    Since these menu items display an arrow to indicate that they have sub menu items I also hide this arrow to achieve the default menu look and feel.

    I hope this helps. You can write back if you need further assistance.

    Greetings,
    Deyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Nhan Rao
    Nhan Rao avatar
    7 posts
    Member since:
    Sep 2009

    Posted 14 Dec 2009 Link to this post

    Thank you for the code snippet.  It almost works.  There are 2 issues, though.  One is that not all of the main menu elements highlight fully when you mouse over them.  It's as if there is a fixed highlight region, so if the menu item has longer text, only part of it gets highlighted.  The other issue is that the menus still open to the right of the main menu items instead of below them.  I'm guessing this may not be fixable.

    The hiding of the right part of the application menu is useful, though.  My boss didn't like that part at all, so that may at least be a compromise.  
  7. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 17 Dec 2009 Link to this post

    Hi Nhan,

    Thanks for getting back to me. The code snippet that I sent to you does the job with the drop down position for me. It seems that your setup is a little bit different and therefore I will need some more information in order to determine the reason why the drop-downs are not shown at the correct position. I use the code snippet in the OnLoad method of my form.

    If you manage to send me a simple WinForms application that reproduces both issues you reported, it will be extremely helpful for me to determine the reason for the undesired behavior, especially the one related to the inproper highlighting.

    Thanks for your time. I look forward to receiving the requested details.

    Kind regards,
    Deyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for WinForms is Visual Studio 2017 Ready