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

Nesting RadElements in Menu Items

3 Answers 82 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 07 Dec 2017, 06:41 AM

Hello Telerik,

  I would like to implement a menu item as shown in your sample here -> (https://docs.telerik.com/devtools/winforms/menus/menu/working-with-radmenu-items/nesting-controls-in-menu-items#nesting-radelements-in-menu-items) Where there is an input box and OK button.  However, I am not to get the same effect as shown in the sample.  I'm actually not sure what the "radmenu1" item is in the sample

Desired result:

Option1

-----------

Option 2

Option 3

Option n....

----------- <- Line separator

[Enter New Option Name Here] OK

 

My sample tests shows the following;

Option1
-----------
Option 2
Option 3
Option n....
----------- <- Line separator
[Enter New Option Name Here]

OK

Also, is there a concept of a "placeholder" for the [Enter New Option Name Here] text so that it goes away when you start typing?

Thanks

3 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 07 Dec 2017, 03:19 PM

I need to clarify this more.

I would like to create this type of menu in CommandBarDropDownButton.

I the image, I want to replace the /NEW FOLDER RadMenuItem with the combination Text Box and OK button.

0
Mike
Top achievements
Rank 1
answered on 07 Dec 2017, 06:23 PM

For our particular use case, we will be implementing a dialog box to enter a new folder name so that we can validate the entry before continuing.  This validation and feedback to the user may be too much to implement as a menu item.

Thanks.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Dec 2017, 11:57 AM
Hello, Mike,

Thank you for writing.  

Here is a sample code snippet demonstrating how to add a horizontal alignment of the textbox and the button:

RadMenuItem mainItem = new RadMenuItem();
 mainItem.Text = "Here is my item";
 
 StackLayoutElement stack = new StackLayoutElement();
 stack.StretchHorizontally = true;
 
 RadTextBoxElement textBox = new RadTextBoxElement();
 textBox.Text = "Enter text here";
 textBox.MinSize = new Size(70, 0);                    
  stack.Children.Add(textBox);
 
 RadButtonElement button = new RadButtonElement();
 button.Text = "OK";
 button.StretchHorizontally = false;
 button.Click += new EventHandler(button_Click);
 stack.Children.Add(button);
 
 RadMenuItem item = new RadMenuItem();
 item.Children.Add(stack);
 mainItem.Items.Add(item);
 radMenu1.Items.Add(mainItem);



I hope this information helps. Should you have further questions I would be glad to help.
 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 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
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or