Skip to main content
A newer version of this page is available.

SnapDocument.BeforeInsertSnList Event

Occurs before a new list is created.

Namespace: DevExpress.Snap.Core.API

Assembly: DevExpress.Snap.v20.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