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.
}