Skip to main content

DxRichEdit.ReadOnly Property

Specifies whether users can edit a document.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v24.1.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

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

Property Value

Type Default Description
Boolean false

true if a user cannot change a document’s content; otherwise, false.

Remarks

Set the ReadOnly property to true to block keyboard input and disable UI elements and hotkeys that change document content. You can use the Rich Text Editor’s API to edit and format a document in read-only mode.

The ReadOnlyChanged event occurs when the ReadOnly property value changes.

The following code snippet enables read-only mode:

<DxRichEdit @ref="richEdit" @bind-ReadOnly="@readOnly" />

@code {
    DxRichEdit richEdit { get; set; }
    bool readOnly { get; set; }
    protected override Task OnAfterRenderAsync(bool firstRender) {
        if (firstRender)
            InitializeDocument();
        return base.OnAfterRenderAsync(firstRender);
    }
    async void InitializeDocument() {
        readOnly = true;
    }
}
See Also