Hi,
I have added menu items and submenu items to the start icon in the radribbion bar .But the width and hegiht is not proper for submenuitems.
Please refer the screenshots
I am getting as in screen (submenuheight) but i want it as shown in screen(sample).
How can i do it any propery .
Thanks
Hema
I have added menu items and submenu items to the start icon in the radribbion bar .But the width and hegiht is not proper for submenuitems.
Please refer the screenshots
I am getting as in screen (submenuheight) but i want it as shown in screen(sample).
How can i do it any propery .
Thanks
Hema
3 Answers, 1 is accepted
0
Hello Hema,
Thank you for writing.
The observed behavior is caused, because all RadMenuItems are sizing themselves according to their content. In your case you have added images to some of the items and they sized themselves according to the image size. However, if you want to have all items with size equal to the biggest item size, please consider the following snippet:
I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.
Kind regards,
Stefan
the Telerik team
Thank you for writing.
The observed behavior is caused, because all RadMenuItems are sizing themselves according to their content. In your case you have added images to some of the items and they sized themselves according to the image size. However, if you want to have all items with size equal to the biggest item size, please consider the following snippet:
public
Form1()
{
InitializeComponent();
radRibbonBar1.RibbonBarElement.ApplicationButtonElement.DropDownOpening +=
new
CancelEventHandler(ApplicationButtonElement_DropDownOpening);
}
void
ApplicationButtonElement_DropDownOpening(
object
sender, CancelEventArgs e)
{
int
maxHeight = 0;
foreach
(RadMenuItem item
in
radRibbonBar1.StartMenuItems)
{
if
(item.Size.Height > maxHeight)
{
maxHeight = item.Size.Height;
}
}
foreach
(RadMenuItem item
in
radRibbonBar1.StartMenuItems)
{
item.MinSize =
new
Size(item.Size.Width, maxHeight);
}
}
I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.
Kind regards,
Stefan
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0
hema
Top achievements
Rank 1
answered on 19 Jul 2011, 10:07 AM
Hi,
Thanks the height for the main menus is set.
But now my issue is the submenuitems should be displayes exactly beside the main menu item as in screen(sample.jpg).But the submenu items are displaying from the top as in (screebshot2.jpg).
So how can i get it ....
Thanks in Adavance
Hema
Thanks the height for the main menus is set.
But now my issue is the submenuitems should be displayes exactly beside the main menu item as in screen(sample.jpg).But the submenu items are displaying from the top as in (screebshot2.jpg).
So how can i get it ....
Thanks in Adavance
Hema
0
Hi Hema,
This is the default application menu behavior as specified by MS RibbonBar specification. You can customize it by handling the DropDownOpening event. Here is a sample:
Please note that the first level menu width is controlled by the RightColumnWidth property:
If you have further questions, I will be glad to assist you.
Greetings,
Jack
the Telerik team
This is the default application menu behavior as specified by MS RibbonBar specification. You can customize it by handling the DropDownOpening event. Here is a sample:
RadMenuItem item = (RadMenuItem)menu.Items[2];
item.DropDownOpening +=
new
CancelEventHandler(item_DropDownOpening);
void
item_DropDownOpening(
object
sender, CancelEventArgs e)
{
RadMenuItem item = (RadMenuItem)sender;
RadPopupOpeningEventArgs args = (RadPopupOpeningEventArgs)e;
Point pt = item.ElementTree.Control.PointToScreen(
new
Point(0, item.ControlBoundingRectangle.Y));
args.CustomLocation =
new
Point(args.CustomLocation.X, pt.Y);
item.DropDown.MinimumSize = Size.Empty;
}
Please note that the first level menu width is controlled by the RightColumnWidth property:
menu.ShowTwoColumnDropDownMenu =
false
;
menu.RightColumnWidth = 100;
If you have further questions, I will be glad to assist you.
Greetings,
Jack
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!