TXTextControl.WPF.RibbonFormattingTab Class

The WPF.RibbonFormattingTab class represents a ribbon tab for setting font and paragraph attributes, formatting styles and for handling the clipboard. It is inherited from the System.Windows.Controls.Ribbon.RibbonTab class and must be hosted in a System.Windows.Controls.Ribbon.Ribbon object. It can be connected with a WPF.TextControl through the WPF.TextControl.RibbonFormattingTab property. Each item has a name, available through its Name property, which corresponds with a member of the WPF.RibbonFormattingTab.RibbonItem enumeration. The FrameworkElement.FindName method can be used to get a certain item and manipulate, move or delete it. To use the WPF.RibbonFormattingTab class, Microsoft Ribbon for WPF 3.5 must be installed.

Introduced: 22.0.

Syntax

[C#]
public class RibbonFormattingTab : System.Windows.Controls.Ribbon.RibbonTab
[Visual Basic]
Public Class RibbonFormattingTab
  Inherits System.Windows.Controls.Ribbon.RibbonTab

Enumerations

Enumeration Description
RibbonItem Each RibbonItem represents an item in a WPF.RibbonFormattingTab.

Example

The RibbonFormattingTab can be configured. The following example removes the Bold button from a RibbonFormattingTab and inserts a simple button instead:

[C#]
FrameworkElement boldButton = ribbonFormattingTab1.FindName(RibbonFormattingTab.RibbonItem.TXITEM_Bold.ToString()) as FrameworkElement;
ItemsControl ic = boldButton.Parent as ItemsControl;
if (ic != null) {
	ic.Items.Remove(boldButton);
	RibbonButton ribbonButton = new RibbonButton();
	ribbonButton.Label = "New Button";
	ic.Items.Insert(0, ribbonButton);
}
[Visual Basic]
Dim boldButton As FrameworkElement = TryCast(ribbonFormattingTab1.FindName(RibbonFormattingTab.RibbonItem.TXITEM_Bold.ToString()), FrameworkElement)
Dim ic As ItemsControl = TryCast(boldButton.Parent, ItemsControl)
If ic IsNot Nothing Then
	ic.Items.Remove(boldButton)
	Dim ribbonButton As New RibbonButton()
	ribbonButton.Label = "New Button"
	ic.Items.Insert(0, ribbonButton)
End If

See Also