HypernovaDesktop Components · docs
Binarymission
WPF › Ribbon › BinaryRibbonThumbnailControl

BinaryRibbonThumbnailControl

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Office

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
ImageSourceGets or sets the picture the thumbnail shows.
StretchGets or sets how this thumbnail's picture should fill its cell.
Methods
OnMouseEnterTells the gallery the pointer is on this thumbnail, which sets BinaryRibbonGallery.MouseOverThumbnail and asks for a live preview.
OnMouseLeaveTells the gallery the pointer has left this thumbnail, which clears BinaryRibbonGallery.MouseOverThumbnail and cancels any live preview.
OnMouseLeftButtonDownSelects the thumbnail in its gallery, after the base handling of the press, and marks the press handled.
OnMouseLeftButtonUpCloses the gallery's drop-down if this thumbnail has the keyboard focus, after the base handling of the release.
Fields
ImageSourcePropertyIdentifies the ImageSource dependency property.
StretchPropertyIdentifies the Stretch dependency property.

Properties

ImageSource

public ImageSource 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

public Stretch 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

protected override void OnMouseEnter(System.Windows.Input.MouseEventArgs e)

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

protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)

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

protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)

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

protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e)

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

public static readonly DependencyProperty ImageSourceProperty

Identifies the ImageSource dependency property.

StretchProperty static

public static readonly DependencyProperty StretchProperty

Identifies the Stretch dependency property.