Today, we are going to share with you how you can use custom editors in our brand new TreeView control. The process of assigning a custom editor includes three steps. The first step is to make the TreeView editable. To do that, set its EnableItemEdit property to true which will ensure that an edit operation will start over the Selected item when you press the F2 key.

The second step is to set the DisplayValue, Value and EditTemplate properties of the TreeViewItem in order to associate the custom editor with the specific TreeViewItem. The TreeView uses a TextBox control as a default editor.

The DisplayValue property represents the value which will be displayed when the item is shown. The Value property represents the logical value which will be edited. The most important property which we need to set is the EditTemplate. It specifies the actual DataTemplate of the custom editor control. Here is the ComboBoxTemplate which we use as an EditTemplate in our TreeViewItem.