windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-448aa261.md
Fires in response to changing a selection in the document.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.XtraRichEdit.v25.2.dll
NuGet Package : DevExpress.Win.RichEdit
public event EventHandler SelectionChanged
Public Event SelectionChanged As EventHandler
The SelectionChanged event's data class is EventArgs.
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
InitializeComponent();
richEditControl1.SelectionChanged += richEditControl1_SelectionChanged;
richEditControl1.DocumentLayout.DocumentFormatted += DocumentLayout_DocumentFormatted;
winforms-rich-edit-implement-ms-office-word-format-painter/CS/DXApplication9/Form1.cs#L62
richEditControl.StartHeaderFooterEditing += richEditControl_StartHeaderFooterEditing;
richEditControl.SelectionChanged += richEditControl_SelectionChanged;
richEditControl.FinishHeaderFooterEditing += richEditControl_FinishHeaderFooterEditing;
winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L302
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
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
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
richEditControl.Tag = buttonCustomAction
AddHandler richEditControl.SelectionChanged, AddressOf richEditControl_SelectionChanged
richEditControl.LoadDocument("Documents\TableSampleDocument.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml)
See Also