ButtonEdit
- 2 minutes to read
Overview
The ButtonEdit control is an advanced text box editor that allows nesting buttons inside of it.
The ButtonEdit control offers the following features.
Unlimited number of nested buttons
ButtonEdit can display any number of nested buttons that are stored in the ButtonEdit.Buttons collection. Individual nested buttons are represented by the ButtonInfo objects.
Customizable button appearance and alignment
Each button can be individually customized. To specify the desired button glyph, use the ButtonInfo.GlyphKind property. To left-align a nested button, set the ButtonInfoBase.IsLeft property to true.
Optional default button
By default, ButtonEdit displays a single button. To control its availability, use the ButtonEdit.AllowDefaultButton property. Clicking the default button raises the ButtonEdit.DefaultButtonClick event.
Common editor features
Like other DevExpress WPF data editors, ButtonEdit supports masked user input and the data validation mechanism.
Optimized for in-place editing
ButtonEdit can be used standalone or as an in-place editor nested in a container control. The ButtonEditSettings class implements the in-place editing functionality. See In-place Editors to learn more.
Standalone ButtonEdit
To add a standalone ButtonEdit to a Window, drag it from the Toolbox and populate its ButtonEdit.Buttons collection with the ButtonInfo objects.
The following sample demonstrates how to create a ButtonEdit using XAML markup.
<dxe:ButtonEdit x:Name="buttonEdit1" AllowDefaultButton="True" DefaultButtonClick="buttonEdit1_DefaultButtonClick">
<dxe:ButtonInfo GlyphKind="Undo" Command="ApplicationCommands.Undo"/>
<dxe:ButtonInfo GlyphKind="Redo" Command="ApplicationCommands.Redo"/>
</dxe:ButtonEdit>
In-place ButtonEdit
To embed a ButtonEdit into a container control, use the ButtonEditSettings class.
The following sample demonstrates how to embed a ButtonEdit into a GridControl column.
<dxg:GridControl Name="grid">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="ProductName">
<dxg:GridColumn.EditSettings>
<dxe:ButtonEditSettings DefaultButtonClick="ButtonEditSettings_DefaultButtonClick"/>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
</dxg:GridControl.Columns>
</dxg:GridControl>