Back to Devexpress

ContentChangedEventArgs Class

blazor-devexpress-dot-blazor-dot-richedit-b80e61d9.md

latest1.8 KB
Original Source

ContentChangedEventArgs Class

Contains data for the ContentInserted event.

Namespace : DevExpress.Blazor.RichEdit

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

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

csharp
public class ContentChangedEventArgs :
    EventArgs

ContentChangedEventArgs is the data class for the following events:

Remarks

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);
        }
    }
}

Inheritance

Object EventArgs ContentChangedEventArgs ContentRemovedEventArgs

See Also

ContentChangedEventArgs Members

DevExpress.Blazor.RichEdit Namespace