BinaryRibbonThumbnailControl
One picture choice in a BinaryRibbonGallery – a style, a colour, a layout – drawn as a
cell that highlights under the pointer and stays pressed while it is selected.
public class BinaryRibbonThumbnailControl : ListBoxItem, IBinaryRibbonKeyTipControl
Inherits from / implements: ListBoxItem, IBinaryRibbonKeyTipControl
Remarks
Add one to the gallery's ItemsControl.Items for each choice, with its picture in
ImageSource. Its FrameworkElement.Tag and
FrameworkElement.ToolTip are the natural places for the value it stands for and its
name. The gallery sizes each thumbnail from BinaryRibbonGallery.ThumbnailSize, and the
picture fills it as the gallery's BinaryRibbonGallery.StretchProperty says.
A click selects the thumbnail in its gallery. The gallery shows a copy of each thumbnail on the
ribbon; a click on the copy selects the original, so SelectedItem is always
the thumbnail you added. A key tip (BinaryKeyTip.AccessKeyProperty) on a thumbnail
selects it too.
Examples
<ribbon:BinaryRibbonGallery TitleText="Label layout" ThumbnailSize="48,48"
xmlns:ribbon="clr-namespace:Binarymission.WPF.Controls.Office;assembly=Binarymission.WPF.Controls.BinaryRibbon">
<ribbon:BinaryRibbonThumbnailControl ImageSource="Images/Labels/Address.png" Tag="Address" ToolTip="Address label" />
<ribbon:BinaryRibbonThumbnailControl ImageSource="Images/Labels/Shipping.png" Tag="Shipping" ToolTip="Shipping label" />
<ribbon:BinaryRibbonThumbnailControl ImageSource="Images/Labels/Barcode.png" Tag="Barcode" ToolTip="Barcode label" />
</ribbon:BinaryRibbonGallery>See also
Members at a glance
| Properties | |
|---|---|
ImageSource | Gets or sets the picture the thumbnail shows. |
Stretch | Gets or sets how this thumbnail's picture should fill its cell. |
| Methods | |
OnMouseEnter | Tells the gallery the pointer is on this thumbnail, which sets
BinaryRibbonGallery.MouseOverThumbnail and asks for a live preview. |
OnMouseLeave | Tells the gallery the pointer has left this thumbnail, which clears
BinaryRibbonGallery.MouseOverThumbnail and cancels any live preview. |
OnMouseLeftButtonDown | Selects the thumbnail in its gallery, after the base handling of the press, and marks the press handled. |
OnMouseLeftButtonUp | Closes the gallery's drop-down if this thumbnail has the keyboard focus, after the base handling of the release. |
| Fields | |
ImageSourceProperty | Identifies the ImageSource dependency property. |
StretchProperty | Identifies the Stretch dependency property. |
Properties
ImageSource
Gets or sets the picture the thumbnail shows.
- Value
- The picture. The default is
null, which shows an empty cell.
Remarks
The gallery's copy of the thumbnail on the ribbon takes the picture when the gallery lays its items out, so set it before adding the thumbnail to the gallery; a picture changed later shows in the drop-down but not on the ribbon until the items next change.
Stretch
Gets or sets how this thumbnail's picture should fill its cell.
- Value
- The stretch. The default is
Fill.
Remarks
The built-in template does not read this property: the picture is drawn with the gallery's attached
BinaryRibbonGallery.StretchProperty, which the gallery copies to each thumbnail. Set
that one on the gallery instead.
Methods
OnMouseEnter
Tells the gallery the pointer is on this thumbnail, which sets
BinaryRibbonGallery.MouseOverThumbnail and asks for a live preview.
Parameters
e- The data for the event.
OnMouseLeave
Tells the gallery the pointer has left this thumbnail, which clears
BinaryRibbonGallery.MouseOverThumbnail and cancels any live preview.
Parameters
e- The data for the event.
OnMouseLeftButtonDown
Selects the thumbnail in its gallery, after the base handling of the press, and marks the press handled.
Parameters
e- The data for the event.
OnMouseLeftButtonUp
Closes the gallery's drop-down if this thumbnail has the keyboard focus, after the base handling of the release.
Parameters
e- The data for the event.
Fields
ImageSourceProperty static
Identifies the ImageSource dependency property.
StretchProperty static
Identifies the Stretch dependency property.