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

Open RadMenuItem PopUp Bottom Right

4 Answers 167 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Seth
Top achievements
Rank 1
Seth asked on 13 Dec 2016, 04:18 AM

Does anyone know how to make the RadMenuItem PopUp open to the bottom right? 

DropDownPlacement has Bottom, Top, Right, Left and Auto.  But I cannot find a way to move the popup to the bottom right.  

4 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 13 Dec 2016, 02:15 PM
Hi Seth,

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Seth
Top achievements
Rank 1
answered on 13 Dec 2016, 07:07 PM

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);
                }
            }
        }

 

0
Seth
Top achievements
Rank 1
answered on 13 Dec 2016, 07:24 PM

I figured it out by drilling down through the properties of the PopUp.  

popup.HorizontalOffset = (menuItem.ActualWidth - ((Grid) popup.Child).ActualWidth);

0
Nasko
Telerik team
answered on 14 Dec 2016, 07:26 AM
Hi Seth,

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Menu
Asked by
Seth
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Seth
Top achievements
Rank 1
Share this question
or