Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxRichEdit.ReadOnly Property

Specifies whether users can edit a document.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

#Declaration

C#
[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:

Razor
<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