Back to Devexpress

DxRichEdit.ReadOnly Property

blazor-devexpress-dot-blazor-dot-richedit-dot-dxrichedit-79f16d0c.md

latest1.7 KB
Original Source

DxRichEdit.ReadOnly Property

Specifies whether users can edit a document.

Namespace : DevExpress.Blazor.RichEdit

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

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

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

Property Value

TypeDefaultDescription
Booleanfalse

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

DxRichEdit Class

DxRichEdit Members

DevExpress.Blazor.RichEdit Namespace