Back to Devexpress

RichEditControl.SelectionChanged Event

windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-448aa261.md

latest4.8 KB
Original Source

RichEditControl.SelectionChanged Event

Fires in response to changing a selection in the document.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.XtraRichEdit.v25.2.dll

NuGet Package : DevExpress.Win.RichEdit

Declaration

csharp
public event EventHandler SelectionChanged
vb
Public Event SelectionChanged As EventHandler

Event Data

The SelectionChanged event's data class is EventArgs.

Remarks

Use a SelectionChanged event handler to perform specific actions each time the end-user selects the text in a document.

The following code snippets (auto-collected from DevExpress Examples) contain references to the SelectionChanged event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-emulate-the-ms-word-status-bar/CS/WindowsFormsApplication1/Form1.cs#L20

csharp
InitializeComponent();
richEditControl1.SelectionChanged += richEditControl1_SelectionChanged;
richEditControl1.DocumentLayout.DocumentFormatted += DocumentLayout_DocumentFormatted;

winforms-rich-edit-implement-ms-office-word-format-painter/CS/DXApplication9/Form1.cs#L62

csharp
richEditControl.StartHeaderFooterEditing += richEditControl_StartHeaderFooterEditing;
richEditControl.SelectionChanged += richEditControl_SelectionChanged;
richEditControl.FinishHeaderFooterEditing += richEditControl_FinishHeaderFooterEditing;

winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L302

csharp
richEditControl.Tag = buttonCustomAction;
richEditControl.SelectionChanged += richEditControl_SelectionChanged;
richEditControl.LoadDocument("Documents\\TableSampleDocument.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml);

winforms-richedit-emulate-the-ms-word-status-bar/VB/WindowsFormsApplication1/Form1.vb#L19

vb
InitializeComponent()
AddHandler richEditControl1.SelectionChanged, AddressOf richEditControl1_SelectionChanged
AddHandler richEditControl1.DocumentLayout.DocumentFormatted, AddressOf DocumentLayout_DocumentFormatted

winforms-rich-edit-implement-ms-office-word-format-painter/VB/DXApplication9/Form1.vb#L58

vb
AddHandler richEditControl.StartHeaderFooterEditing, AddressOf richEditControl_StartHeaderFooterEditing
AddHandler richEditControl.SelectionChanged, AddressOf richEditControl_SelectionChanged
AddHandler richEditControl.FinishHeaderFooterEditing, AddressOf richEditControl_FinishHeaderFooterEditing

winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L309

vb
richEditControl.Tag = buttonCustomAction
AddHandler richEditControl.SelectionChanged, AddressOf richEditControl_SelectionChanged
richEditControl.LoadDocument("Documents\TableSampleDocument.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml)

See Also

RichEditControl Class

RichEditControl Members

DevExpress.XtraRichEdit Namespace