Getting Started with WinForms ButtonTextBox
RadButtonTextBox is used to get input from the user or to display text. It exposes left/right StackLayoutPanels which host button elements on the left/right side of the text box.
The text displayed by the control resides in the Text property. It can be set at design time via the Properties window in Visual Studio, at run time in code, or by the user's input at run time. The current contents of a text box can be retrieved at run time by the Text property.
The following tutorial demonstrates how to add buttons with images to a RadButtonTextBox and how to handle the clicking of the button elements.
- Add a RadButtonTextBox to a form.
- Add three images to the project as resources.
Select the RadButtonTextBox and click the small arrow on the top right position in order to open the Smart Tag. Find the Buttons Left property and click the ellipsis button to open the RadItem Collection Editor.
Click the Add button three times to create three RadButtonElements. Clear the text of the first, second and third button elements respectively. Set the resource images to the Image property of the items.
Click OK to close the RadItem Collection Editor.
In the Properties Window select the Events button.
Locate and double-click the RadButtonElement. Click the event to create an event handler.
You can place any custom code that you wish to be performed when the user clicks the first button element in RadButtonTextBox.