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

ContentChangedEventArgs.Interval Property

Gets the sub-document‘s interval in which content was changed.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

#Declaration

C#
public Interval Interval { get; }

#Property Value

Type Description
Interval

An object that stores the changed content’s length and position.

#Remarks

You can access this event argument inside the ContentInserted and ContentRemoved event handlers. Depending on the event, the Interval property returns the sub-document‘s interval into which content was inserted or from which content was removed.

The following code snippet demonstrates how you can obtain the inserted content and remove new images and text boxes from the document:

Razor
<DxRichEdit ContentInserted="OnContentInserted" />

@code {
    async void OnContentInserted(ContentChangedEventArgs args) {
        // Obtains the inserted content as a text span
        TextSpan textSpan = await args.SubDocument.GetTextSpanAsync(args.Interval);
        // Converts the inserted content to plain text
        string text = textSpan.Text;
        // Removes inserted images and text boxes
        for (int i = text.Length - 1; i >= 0; i--) {
            if (text[i] == '')
                await args.SubDocument.RemoveAsync(args.Interval.Start + i, 1);
        }
    }
}
See Also