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

RadApplicationMenu orientation

5 Answers 153 Views
ApplicationMenu
This is a migrated thread and some comments may be shown as answers.
Nhan Rao
Top achievements
Rank 1
Nhan Rao asked on 09 Dec 2009, 03:24 PM
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.

5 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 09 Dec 2009, 04:30 PM
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.
0
Nhan Rao
Top achievements
Rank 1
answered on 09 Dec 2009, 04:44 PM
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.
0
Deyan
Telerik team
answered on 14 Dec 2009, 09:23 AM
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.
0
Nhan Rao
Top achievements
Rank 1
answered on 14 Dec 2009, 02:36 PM
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.  
0
Deyan
Telerik team
answered on 17 Dec 2009, 01:02 PM
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.
Tags
ApplicationMenu
Asked by
Nhan Rao
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Nhan Rao
Top achievements
Rank 1
Share this question
or