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 |
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 |
---|---|
WinExplorerView |
|
Remarks
Enable the AllowContentSelection
property to allow users to select text displayed by HTML templates.
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; }