BinaryRibbonControlContextualTabSet
A set of contextual tabs: extra tabs at the end of the ribbon's tab row, under a coloured title, that are on show only while the user works on one kind of thing – a picture, a table, a chart.
public class BinaryRibbonControlContextualTabSet : Control, IBinaryRibbonComponent, IBinaryRibbonKeyTipControl
Inherits from / implements: Control, IBinaryRibbonComponent, IBinaryRibbonKeyTipControl
Remarks
Put the tabs in TabItems, give the set a TitleText such as
"Picture Tools" and a BackgroundColor, and keep it ready, for example as a resource.
When the user selects the kind of thing the tabs act on, assign the set to
BinaryRibbonBarPanel.ContextualTabSet; when they move away, set that back to
null. The ribbon shows one set at a time.
The tabs work like any other: they are selected, carry key tips and give way to the window's
width in the same way. Adding a set to BinaryRibbonBarPanel.ContextualTabSets connects it
to the ribbon without showing it.
Examples
A Picture Tools set kept as a window resource and shown while a picture is selected.
<bm:BinaryRibbonWindow.Resources>
<bm:BinaryRibbonControlContextualTabSet x:Key="PictureTools" TitleText="Picture Tools" BackgroundColor="#FFE8A33D">
<bm:BinaryRibbonTabItem HeaderText="Format">
<bm:BinaryRibbonGroup TitleText="Size">
<bm:BinaryRibbonButton Content="Crop" LargeImage="Images/Crop32.png" Click="OnCrop" />
</bm:BinaryRibbonGroup>
</bm:BinaryRibbonTabItem>
</bm:BinaryRibbonControlContextualTabSet>
</bm:BinaryRibbonWindow.Resources>private void OnSelectionChanged(object sender, RoutedEventArgs e)
{
ribbon.ContextualTabSet = editor.SelectedObject is InvoiceLogo
? (BinaryRibbonControlContextualTabSet)FindResource("PictureTools")
: null;
}See also
Members at a glance
| Properties | |
|---|---|
BackgroundColor | Gets or sets the colour of the band behind the set's title, which fades out towards the top. |
BinaryRibbonTag | Gets or sets any object the application wants to keep with the set. |
IsCurrentlySelected | Gets whether the set is the one on show on its ribbon. |
RibbonBarPanel | Gets the ribbon the set is connected to. |
TabItems | Gets the set's tabs, in order. This is the set's content in XAML. |
TitleText | Gets or sets the title shown above the set's tabs, such as "Picture Tools" or "Table Design". |
| Methods | |
OnTabItemCollectionChanged | Called when TabItems changes; the base implementation connects each added tab to this
set and its ribbon, and disconnects each removed one. |
| Fields | |
BackgroundColorProperty | Identifies the BackgroundColor dependency property. |
TitleTextProperty | Identifies the TitleText dependency property. |
Properties
BackgroundColor
Gets or sets the colour of the band behind the set's title, which fades out towards the top.
- Value
- The default is
Colors.Gold, from the built-in style.
BinaryRibbonTag
Gets or sets any object the application wants to keep with the set.
- Value
- The default is
null. The ribbon never reads it.
IsCurrentlySelected
Gets whether the set is the one on show on its ribbon.
- Value
truewhile assigned toBinaryRibbonBarPanel.ContextualTabSet. The default isfalse.
RibbonBarPanel
Gets the ribbon the set is connected to.
- Value
- The ribbon, once the set is assigned to its
BinaryRibbonBarPanel.ContextualTabSetor added to itsBinaryRibbonBarPanel.ContextualTabSets; otherwisenull.
TabItems
Gets the set's tabs, in order. This is the set's content in XAML.
TitleText
Gets or sets the title shown above the set's tabs, such as "Picture Tools" or "Table Design".
- Value
- The default is an empty string.
Methods
OnTabItemCollectionChanged
Called when TabItems changes; the base implementation connects each added tab to this
set and its ribbon, and disconnects each removed one.
Parameters
sender- The collection.
e- The tabs added or removed.
Fields
BackgroundColorProperty static
Identifies the BackgroundColor dependency property.
TitleTextProperty static
Identifies the TitleText dependency property.