Skip to main content

EditOptions.ReadOnly Property

Specifies whether an editor for customizing a control’s content in Print Preview is enabled.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v23.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[DefaultValue(false)]
public bool ReadOnly { get; set; }

Property Value

Type Default Description
Boolean false

true, to prohibit editing a control’s content in Print Preview; otherwise, false.

Remarks

You can enable content editing for a report control by setting the EditOptions.Enabled property to true. This results in one or more corresponding editing fields being added to the PrintingSystemBase.EditingFields collection.

When the ReadOnly property is enabled, a corresponding field cannot be edited in Print Preview and is not highlighted as an editing field. The following code illustrates how to use this property to disable content editing for a specific user.

using DevExpress.XtraPrinting;
// ...

private void XtraReport1_BeforePrint(object sender, System.ComponentModel.EventArgs e) {
    PrintingSystem.AfterBuildPages += PrintingSystem_AfterBuildPages;
}

private static string userName = System.Environment.UserName;

void PrintingSystem_AfterBuildPages(object sender, System.EventArgs e) {
    if (userName == "fuller.andrew")
        foreach (EditingField field in PrintingSystem.EditingFields)
            field.ReadOnly = true;
}

For more information, see Content Editing in Print Preview.

See Also