BinaryRibbonTabItem
One tab of a BinaryRibbonBarPanel: a heading in the tab row, and the
BinaryRibbonGroups of commands shown beneath it while it is selected.
public class BinaryRibbonTabItem : Control, IBinaryRibbonKeyTipControl
Inherits from / implements: Control, IBinaryRibbonKeyTipControl
Remarks
Gather the commands for one activity on a tab – Home, Insert, Review – and give the tab a short
HeaderText. Its content is AvailableRibbonGroups, laid out from left to
right; when the window is too narrow, the last group gives way first.
Selecting
A click selects the tab, and a double-click switches the ribbon between showing its commands and showing only its tabs. From code,
set BinaryRibbonBarPanel.SelectedTabItem or
BinaryRibbonBarPanel.SelectedTabIndex; IsCurrentlySelected says which tab
is selected.
Keyboard and contextual tabs
A key tip set with BinaryKeyTip.SetAccessKey selects the tab and then shows the
key tips of its commands. A tab added to a BinaryRibbonControlContextualTabSet rather than
to BinaryRibbonBarPanel.Tabs appears only while that set is on show. Collapse a tab
(UIElement.Visibility) to take it off the tab row.
Examples
<bm:BinaryRibbonTabItem HeaderText="Review" SmallImage="Images/Review16.png" bm:BinaryKeyTip.AccessKey="R">
<bm:BinaryRibbonGroup TitleText="Proofing">
<bm:BinaryRibbonButton Content="Spelling" LargeImage="Images/Spelling32.png" Click="OnSpelling" />
</bm:BinaryRibbonGroup>
<bm:BinaryRibbonGroup TitleText="Approval">
<bm:BinaryRibbonButton Content="Approve" LargeImage="Images/Approve32.png" Click="OnApprove" />
<bm:BinaryRibbonButton Content="Reject" LargeImage="Images/Reject32.png" Click="OnReject" />
</bm:BinaryRibbonGroup>
</bm:BinaryRibbonTabItem>See also
Members at a glance
| Constructors | |
|---|---|
BinaryRibbonTabItem | Creates an empty tab; give it a HeaderText and add groups to
AvailableRibbonGroups. |
| Properties | |
AvailableRibbonGroups | Gets the groups on this tab, in order from left to right. This is the tab's content in XAML. |
BackgroundColor | Gets the colour of the contextual tab set this tab belongs to. |
HeaderText | Gets or sets the tab's heading in the tab row. |
IsContextualTabItem | Gets whether the tab is on show as one of the ribbon's contextual tabs. |
IsCurrentlySelected | Gets whether this is the selected tab, whose groups the ribbon is showing. |
LogicalChildren | Gets the tab's groups, which are its logical children. |
RibbonPanel | Gets the ribbon this tab is on. |
SmallImage | Gets or sets a small picture shown before the heading. |
| Methods | |
EndInit | Completes initialisation and applies the tab's template straight away, so that it can be measured before it is first shown. |
GetImageStretch | Gets how a tab's SmallImage is stretched to its space. |
OnApplyTemplate | Called when the tab's template is applied. |
OnKeyDown | While the tab has the keyboard focus, selects the previous or next tab on show with Left or Right, and this tab with Space. |
OnMouseDoubleClick | Switches the ribbon between showing its commands and showing only its tabs when the tab is double-clicked. |
OnMouseLeftButtonDown | Selects the tab when it is clicked; on a ribbon showing only its tabs, this also drops the tab's commands down. |
SetImageStretch | Sets how a tab's SmallImage is stretched to its space. |
| Fields | |
HeaderTextProperty | Identifies the HeaderText dependency property. |
ImageStretchProperty | Identifies the ImageStretch attached property. The default is Stretch.Uniform. |
IsContextualTabItemProperty | Identifies the IsContextualTabItem dependency property. |
IsCurrentlySelectedProperty | Identifies the IsCurrentlySelected dependency property. |
SmallImageProperty | Identifies the SmallImage dependency property. |
Constructors
BinaryRibbonTabItem
Creates an empty tab; give it a HeaderText and add groups to
AvailableRibbonGroups.
Properties
AvailableRibbonGroups
Gets the groups on this tab, in order from left to right. This is the tab's content in XAML.
Remarks
When the ribbon runs out of room, the groups give way from the last one in this collection back to the first.
BackgroundColor
Gets the colour of the contextual tab set this tab belongs to.
- Value
- The set's
BinaryRibbonControlContextualTabSet.BackgroundColor, orColors.Transparentfor an ordinary tab.
HeaderText
Gets or sets the tab's heading in the tab row.
- Value
- A word or two – "Home", "Insert". The default is an empty string.
Remarks
A heading too long for the tab row ends in an ellipsis; it is also the tab's tool tip, so the whole text can still be read.
IsContextualTabItem
Gets whether the tab is on show as one of the ribbon's contextual tabs.
- Value
truewhile the tab belongs to theBinaryRibbonBarPanel.ContextualTabSeton show. The default isfalse.
IsCurrentlySelected
Gets whether this is the selected tab, whose groups the ribbon is showing.
- Value
- The default is
false.
Remarks
Set by the ribbon; select a tab through BinaryRibbonBarPanel.SelectedTabItem. A custom
tab template can trigger on it to draw the selected look.
LogicalChildren
Gets the tab's groups, which are its logical children.
RibbonPanel
Gets the ribbon this tab is on.
- Value
- The ribbon, or
nulluntil the tab is added to itsBinaryRibbonBarPanel.Tabsor to a contextual tab set connected to it. A tab with no ribbon ignores clicks.
SmallImage
Gets or sets a small picture shown before the heading.
- Value
- Usually 16 by 16 logical pixels. The default is
null: no picture, which is how Office draws its tabs.
See also
Methods
EndInit
Completes initialisation and applies the tab's template straight away, so that it can be measured before it is first shown.
Exceptions
System.InvalidOperationExceptionEndInitwas called without a matchingFrameworkElement.BeginInit.
GetImageStretch static
Gets how a tab's SmallImage is stretched to its space.
Parameters
obj- The tab.
Returns
The stretch; Stretch.Uniform unless set.
OnApplyTemplate
Called when the tab's template is applied.
OnKeyDown
While the tab has the keyboard focus, selects the previous or next tab on show with Left or Right, and this tab with Space.
Parameters
e- The data for the event.
OnMouseDoubleClick
Switches the ribbon between showing its commands and showing only its tabs when the tab is double-clicked.
Parameters
e- The data for the event.
OnMouseLeftButtonDown
Selects the tab when it is clicked; on a ribbon showing only its tabs, this also drops the tab's commands down.
Parameters
e- The data for the event.
SetImageStretch static
Sets how a tab's SmallImage is stretched to its space.
Parameters
obj- The tab.
value- The stretch;
Stretch.Nonedraws the picture at its own size.
Fields
HeaderTextProperty static
Identifies the HeaderText dependency property.
ImageStretchProperty static
Identifies the ImageStretch attached property. The default is Stretch.Uniform.
IsContextualTabItemProperty static
Identifies the IsContextualTabItem dependency property.
IsCurrentlySelectedProperty static
Identifies the IsCurrentlySelected dependency property.
SmallImageProperty static
Identifies the SmallImage dependency property.