4 Answers, 1 is accepted
Currently the desired positioning of the MenuItem is not supported by RadMenu out of the box. However, what we could suggest you in order to achieve the desired is to handle the SubmenuOpened event of the MenuItem. Inside it using the ChildrenOfType<T> method to find the Popup inside which the MenuItems are placed and position it as desired using its Placement, PlacementTarget, PlacementRectangle etc. properties.
We have created a sample project that demonstrates that approach.
Hope this helps.
Regards,
Nasko
Telerik by Progress
That is very close to what I need. I do need the bottom right....however I need the popup to move over beneath the RadMenuItem. However the PopUp Width is null...so basically in the code you sent I would want the following....however popup.ActualWidth is null....is there a way to capture the width of the popup?
private void RadMenuItem_OnSubmenuOpened(object sender, RadRoutedEventArgs e)
{
RadMenuItem menuItem = sender as RadMenuItem;
if (menuItem != null)
{
Popup popup = menuItem.ChildrenOfType<Popup>().FirstOrDefault();
if (popup != null)
{
popup.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
// Set the desired offset as desired
popup.HorizontalOffset = (menuItem.ActualWidth - popup.ActualWidth);
}
}
}
I figured it out by drilling down through the properties of the PopUp.
popup.HorizontalOffset = (menuItem.ActualWidth - ((Grid) popup.Child).ActualWidth);
I am really glad to here the provided approach helped you to achieve the desired behavior and now everything is working as expected for you.
If you have any additional questions or concerns please, do not hesitate to contact us.
Regards,
Nasko
Telerik by Progress