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

RadTextBox With DropDownButton

1 Answer 184 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
IT
Top achievements
Rank 1
IT asked on 12 Apr 2016, 08:27 AM
01.internal class RadTextBoxWithDropDownButton : RadTextBox
02.{
03.    public RadDropDownButtonElement DropDownButtonElement { get; private set; }
04. 
05.    public RadTextBoxWithDropDownButton()
06.    {
07.        DropDownButtonElement = new RadDropDownButtonElement
08.        {
09.            Padding = new Padding(2, 0, 2, -2),
10.            Margin = new Padding(0, 0, 0, 0),
11.            Text = " "
12.        };
13. 
14.        var stackLayoutElement = new StackLayoutElement
15.        {
16.            Orientation = Orientation.Horizontal,
17.            Margin = new Padding(1, 0, 1, 0)
18.        };
19. 
20.        stackLayoutElement.Children.Add(DropDownButtonElement);
21. 
22.        var textBoxItem = TextBoxElement.TextBoxItem;
23.        TextBoxElement.Children.Remove(textBoxItem);
24. 
25.        var dockLayoutPanel = new DockLayoutPanel();
26.        dockLayoutPanel.Children.Add(stackLayoutElement);
27.        dockLayoutPanel.Children.Add(textBoxItem);
28.        DockLayoutPanel.SetDock(textBoxItem, Telerik.WinControls.Layouts.Dock.Left);
29.        DockLayoutPanel.SetDock(stackLayoutElement, Telerik.WinControls.Layouts.Dock.Right);
30. 
31.        TextBoxElement.Children.Add(dockLayoutPanel);
32. 
33.        TextBoxElement.Padding = new Padding(1, 1, 1, 1);
34.        Margin = new Padding(0, 1, 0, 0);
35.    }
36.}

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Apr 2016, 12:48 PM
Hello Fabricio,

Thank you for writing.

The provided sample code snippet is greatly appreciated. The following help article demonstrates a approach for inserting a RadElement in RadTextBox: http://docs.telerik.com/devtools/winforms/editors/textbox/adding-buttons-to-radtextbox

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

 Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
TextBox
Asked by
IT
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or