Skip to main content
All docs
V24.2

WinExplorerViewOptionsHtmlTemplate.AllowContentSelection Property

Gets or sets whether users can select the contents of HTML tags.

Namespace: DevExpress.XtraGrid.WinExplorer

Assembly: DevExpress.XtraGrid.v24.2.dll

Declaration

[DefaultValue(DefaultBoolean.Default)]
[XtraSerializableProperty]
public DefaultBoolean AllowContentSelection { get; set; }

Property Value

Type Default Description
DefaultBoolean Default

Specifies the initial value of the user-select CSS property for all HTML elements. The DefaultBoolean.True value sets this property to auto, the DefaultBoolean.False and DefaultBoolean.Default values set it to none.

Available values:

Name Description Return Value
True

The value is true.

0

False

The value is false.

1

Default

The value is specified by a global option or a higher-level object.

2

Property Paths

You can access this nested property as listed below:

Object Type Path to AllowContentSelection
WinExplorerView
.OptionsHtmlTemplate .AllowContentSelection

Remarks

Enable the AllowContentSelection property to allow users to select text displayed by HTML templates.

Selected text in HTML templates - WinExplorerView

Run Demo

The textual content of the selected region is stored in the SelectedHtmlText property. The code below copies this property’s value to the clipboard when a user presses Ctrl+C:

void OnWinExplorerViewKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) {
    if(Control.ModifierKeys.HasFlag(Keys.Control) && e.KeyCode == Keys.C) {
        var text = winExplorerView1.SelectedHtmlText;
        if(!string.IsNullOrEmpty(text))
            Clipboard.SetText(text);
    }
}

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. Use the user-select CSS property to prevent unwanted HTML elements from being selected when the AllowContentSelection property is enabled.

<div class="button unselectable">Cancel</div>
.unselectable { user-select: none; }

Use the user-select CSS property to enable selection for individual elements if the AllowContentSelection property is set to DefaultBoolean.Default or DefaultBoolean.False.

.selectable { user-select: all; }
.selectableText { user-select: text; }
See Also