Can I select text in the label control in DevExpress?
I need something like this:
Edit
private void AddLayoutItem(LayoutControlGroup group, string name, string description)
{
group.AllowHtmlStringInCaption = true;
LabelControl label = new LabelControl
{
Name = Guid.NewGuid().ToString(),
Text = description,
Font = new Font("Tahoma", 11),
Padding = new Padding(25, 0, 0, 0),
AutoSizeMode = LabelAutoSizeMode.Vertical,
AllowDrop = true,
BorderStyle = 0,
IsAccessible = true
};
AddLayoutItem(group, name, label);
}
LabelControl
does not support selection of the displayed text.
However, this can be achived through TextEdit
, which you can make look like a label, but users are able to select the text. Set it's BorderStyle property to NoBorder and ReadOnly to true.
Your code would look something like this:
private void AddLayoutItem(LayoutControlGroup group, string name, string description)
{
group.AllowHtmlStringInCaption = true;
var edit = new TextEdit
{
Name = Guid.NewGuid().ToString(),
Text = description,
Font = new Font("Tahoma", 11)
};
edit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
edit.Properties.ReadOnly = true;
AddLayoutItem(group, name, edit);
}