Skip to main content
You are viewing help content for a version that is no longer maintained/updated.
All docs
V21.2
  • SnapDocument.BeforeInsertSnList Event

    Occurs before a new list is created.

    Namespace: DevExpress.Snap.Core.API

    Assembly: DevExpress.Snap.v21.2.Core.dll

    NuGet Package: DevExpress.Snap.Core

    Declaration

    event BeforeInsertSnListEventHandler BeforeInsertSnList

    Event Data

    The BeforeInsertSnList event's data class is BeforeInsertSnListEventArgs. The following properties provide information specific to this event:

    Property Description
    DataFields Specifies the data added to the inserted list.
    Position Specifies the position in the document into which a Snap list is being inserted.

    Remarks

    Handle the BeforeInsertSnList event to change the layout of list columns, or to change the position in which the list will be inserted.

    The code sample below shows how to change the alignment of the inserted content:

    using DevExpress.Snap.Core.API;
    using DevExpress.XtraRichEdit.API.Native;
    
    //...
    
    private void Document_BeforeInsertSnList(object sender, BeforeInsertSnListEventArgs e)
    {
        SubDocument subDoc = e.Position.BeginUpdateDocument();
        ParagraphProperties props = subDoc.BeginUpdateParagraphs(subDoc.CreateRange(e.Position, 1));
        props.Alignment = ParagraphAlignment.Left;
        subDoc.EndUpdateParagraphs(props);
        e.Position.EndUpdateDocument(subDoc);
    }
    
    See Also