TreeListOptionsHtmlTemplate.AllowContentSelection Property
Gets or sets whether users can select the contents of HTML tags.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v25.1.dll
NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList
Declaration
[DefaultValue(DefaultBoolean.Default)]
[XtraSerializableProperty]
public DefaultBoolean AllowContentSelection { get; set; }
Property Value
| Type | Default | Description |
|---|---|---|
| DefaultBoolean | Default | Specifies the initial value of the |
Available values:
| Name | Description | Return Value |
|---|---|---|
| True | The value is true. |
|
| False | The value is false. |
|
| Default | The value is specified by a global option or a higher-level object. |
|
Property Paths
You can access this nested property as listed below:
| Object Type | Path to AllowContentSelection |
|---|---|
| TreeList |
|
Remarks
Enable the AllowContentSelection property to allow users to select text displayed by HTML templates. When users drag the mouse pointer to select a portion of text – button captions, images, and other HTML elements along the way are also selected.

The following example copies text content of selected HTML elements to the clipboard when a user presses Ctrl+C:
using DevExpress.XtraTreeList;
private void treeList1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) {
if(e.Control && e.KeyCode ==System.Windows.Forms.Keys.C) {
System.Windows.Clipboard.SetText((sender as TreeList).SelectedHtmlText);
}
}
You can also use the user-select CSS property to prevent unwanted HTML elements from being selected when the AllowContentSelection property is enabled.
If the AllowContentSelection property is set to DefaultBoolean.Default or DefaultBoolean.False, use the user-select CSS property to enable selection for individual HTML elements.
.selectable { user-select: all; }
.selectableText { user-select: text; }