windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-6d54a174.md
Gets whether the entire selection is contained in one table.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.XtraRichEdit.v25.2.dll
NuGet Package : DevExpress.Win.RichEdit
public bool IsSelectionInTable()
Public Function IsSelectionInTable As Boolean
| Type | Description |
|---|---|
| Boolean |
true if a selection is within one table; otherwise, false.
|
The following code activates the Table Tools Ribbon tab if the document selection is located in a document table.
The RichEditControl instance is passed to the BarItem.ItemClick event handler using the BarItem.Tag property.
static void richEditControl_SelectionChanged(object sender, EventArgs e) {
RichEditControl richEdit = (sender as RichEditControl);
BarButtonItem barButton = richEdit.Tag as BarButtonItem;
barButton.Enabled = !richEdit.IsSelectionInTable();
}
Private Shared Sub richEditControl_SelectionChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim richEdit As RichEditControl = (TryCast(sender, RichEditControl))
Dim barButton As BarButtonItem = TryCast(richEdit.Tag, BarButtonItem)
barButton.Enabled = Not richEdit.IsSelectionInTable()
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the IsSelectionInTable() method.
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-rich-edit-implement-ms-office-word-format-painter/CS/DXApplication9/Form1.cs#L77
{
tableToolsRibbonPageCategory1.Visible = richEditControl.IsSelectionInTable();
floatingPictureToolsRibbonPageCategory1.Visible = richEditControl.IsFloatingObjectSelected;
winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L311
BarButtonItem barButton = richEdit.Tag as BarButtonItem;
barButton.Enabled = !richEdit.IsSelectionInTable();
}
winforms-rich-edit-implement-ms-office-word-format-painter/VB/DXApplication9/Form1.vb#L70
Private Sub richEditControl_SelectionChanged(ByVal sender As Object, ByVal e As EventArgs)
tableToolsRibbonPageCategory1.Visible = richEditControl.IsSelectionInTable()
floatingPictureToolsRibbonPageCategory1.Visible = richEditControl.IsFloatingObjectSelected
winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L318
Dim barButton As BarButtonItem = TryCast(richEdit.Tag, BarButtonItem)
barButton.Enabled = Not richEdit.IsSelectionInTable()
End Sub
See Also