# How to: Create a Functional ButtonEdit | WPF Controls | DevExpress Documentation

[ButtonEdit](/WPF/DevExpress.Xpf.Editors.ButtonEdit) is a text editor which can display an unlimited number of fully customizable buttons.

This document demonstrates how to create a [ButtonEdit](/WPF/DevExpress.Xpf.Editors.ButtonEdit) control and customize its buttons.

## Create a New Project and Add a ButtonEdit

1. Run MS Visual Studio and create a new WPF Application project.
2. Add a [ButtonEdit](/WPF/DevExpress.Xpf.Editors.ButtonEdit) component to the project.

     To do this, open the Visual Studio toolbox, locate the “DX: Common Controls” category, choose the **ButtonEdit** toolbox item and drop it onto the window.

     ![Toolbox ButtonEdit](/WPF/images/toolbox-buttonedit14753.png)

- XAML

<section id="tabpanel_UyyNI9JgJz_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">&lt;Window x:Class=&quot;ButtonEdit_with_functionality.MainWindow&quot;
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
        Title=&quot;MainWindow&quot; Height=&quot;250&quot; Width=&quot;350&quot; xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:ButtonEdit HorizontalAlignment=&quot;Left&quot; Margin=&quot;25,75,0,0&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;275&quot; Height=&quot;35&quot;/&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;
</code></pre></section>

## Add Buttons to the ButtonEdit

1. Right click the **ButtonEdit** and select **Properties**. Hide the default button by setting the [ButtonEdit.AllowDefaultButton](/WPF/DevExpress.Xpf.Editors.ButtonEdit.AllowDefaultButton) property to **false**.

     ![ButtonEdit Behavior](/WPF/images/buttonedit-behavior14756.png)
2. Select the **Buttons** property. Invoke **Collection Editor: Buttons**.

     ![ButtonEdit Common](/WPF/images/buttonedit-common14758.png)

     In the **Collection Editor**, add two **ButtonInfo** items. Select the first **ButtonInfo** item, and set the **Content** property to “Clear” and **IsLeft** property to **true**. Select the second **ButtonInfo** item and set the **GlyphKind** property to “Apply”.

     ![Collection Editor Buttons 1](/WPF/images/collection-editor-buttons-114763.png)

- XAML

<section id="tabpanel_UyyNI9JgJz-1_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">&lt;Window x:Class=&quot;ButtonEdit_with_functionality.MainWindow&quot;
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
        Title=&quot;MainWindow&quot; Height=&quot;250&quot; Width=&quot;350&quot; xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:ButtonEdit x:Name=&quot;ButtonEdit&quot; HorizontalAlignment=&quot;Left&quot; Margin=&quot;25,75,0,0&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;275&quot; Height=&quot;35&quot; AllowDefaultButton=&quot;False&quot; &gt;
            &lt;dxe:ButtonInfo Content=&quot;Clear&quot; IsLeft=&quot;True&quot;/&gt;
            &lt;dxe:ButtonInfo GlyphKind=&quot;Apply&quot; /&gt;
        &lt;/dxe:ButtonEdit&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;
</code></pre></section>

## Add Functionality to the Buttons

1. Handle the **Click** event of the “Apply” button to invoke a message box with information about the **ButtonEdit** control. Handle the **Click** event of the “Clear” button to clear the text in the **ButtonEdit**.

- XAML

<section id="tabpanel_UyyNI9JgJz-2_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">&lt;Window x:Class=&quot;ButtonEdit_with_functionality.MainWindow&quot;
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
        Title=&quot;MainWindow&quot; Height=&quot;250&quot; Width=&quot;350&quot; xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:ButtonEdit x:Name=&quot;ButtonEdit&quot; HorizontalAlignment=&quot;Left&quot; Margin=&quot;25,75,0,0&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;275&quot; Height=&quot;35&quot; AllowDefaultButton=&quot;False&quot; &gt;
            &lt;dxe:ButtonInfo Click=&quot;Clear_Button_Click&quot; Content=&quot;Clear&quot; IsLeft=&quot;True&quot;/&gt;
            &lt;dxe:ButtonInfo Click=&quot;Apply_Button_Click&quot; GlyphKind=&quot;Apply&quot; /&gt;
        &lt;/dxe:ButtonEdit&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;
</code></pre></section>

- C#

<section id="tabpanel_UyyNI9JgJz-3_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code class="lang-csharp">namespace ButtonEdit_with_functionality {

    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
        }
        private void Clear_Button_Click(object sender, RoutedEventArgs e) {
            ButtonEdit.EditValue = string.Empty;
        }

        private void Apply_Button_Click(object sender, RoutedEventArgs e) {
            string Info = &quot;&quot;;
            string EOL = &quot;\n&quot;;
            Info += &quot; Text: &quot; + ButtonEdit.Text + EOL;
            Info += &quot; Margin: &quot; + ButtonEdit.Margin + EOL;
            Info += &quot; Width: &quot; + ButtonEdit.Width + EOL;
            Info += &quot; Height: &quot; + ButtonEdit.Height + EOL;
            Info += &quot; Mask: &quot; + ButtonEdit.Mask + EOL;
            MessageBox.Show(Info, &quot;ButtonEdit properties&quot;);
        }
    }
}
</code></pre></section>
2. Run the application to see the result.

     ![ButtonEdit app Main Window](/WPF/images/buttonedit-app-main-window14771.png)