In This Article

RibbonGallery Class

Represents a gallery control, for use within a Ribbon.

[TemplatePart(Name = "PART_CollapsedButton", Type = typeof(BarPopupButton))]
[TemplatePart(Name = "PART_ExpandedElement", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "PART_MoreButton", Type = typeof(RibbonGalleryMoreButton))]
public class RibbonGallery : BarMenuGalleryHostBase, IOrientedElement
Inheritance:
object Visual UIElement FrameworkElement Control ItemsControl Selector BarGalleryBase BarMenuGalleryHostBase object
Implements:
IOrientedElement

Constructors

RibbonGallery()

Initializes an instance of the class.

public RibbonGallery()

Properties

CanAutoScrollToSelectedItem

Indicates whether to automatically scroll to the selected item on selection changes.

public bool CanAutoScrollToSelectedItem { get; set; }

Property Value

bool:

true if the selected item should automatically be scrolled into view on selection changes; otherwise, false. The default value is false.

CollapsedButtonToolTip

The tooltip for the collapsed button.

public object? CollapsedButtonToolTip { get; set; }

Property Value

object

IsScrolling

Indicates whether the gallery is currently being scrolled.

public bool IsScrolling { get; }

Property Value

bool:

true if the gallery is currently being scrolled; otherwise, false.

KeyTipText

The key tip text used to access the control.

[Localizability(LocalizationCategory.Label)]
public string? KeyTipText { get; set; }

Property Value

string

LayoutMode

A RibbonLayoutMode indicating the layout mode in use.

public RibbonLayoutMode LayoutMode { get; set; }

Property Value

RibbonLayoutMode

MaxColumnCount

The maximum number of columns when in-ribbon.

public int MaxColumnCount { get; set; }

Property Value

int:

The default value is 15.

MaxItemsPresenterHeight

The maximum height of the in-ribbon items presenter.

public double MaxItemsPresenterHeight { get; set; }

Property Value

double

MinLargeColumnCount

The minimum number of columns to use when in-ribbon with a Large variant size.

public int MinLargeColumnCount { get; set; }

Property Value

int:

The default value is 5.

MinMediumColumnCount

The minimum number of columns to use when in-ribbon with a Medium variant size.

public int MinMediumColumnCount { get; set; }

Property Value

int:

The default value is 3.

ScrollDownCommand

The ICommand used to invoke the ScrollDown() method.

public ICommand ScrollDownCommand { get; }

Property Value

ICommand

ScrollUpCommand

The ICommand used to invoke the ScrollUp() method.

public ICommand ScrollUpCommand { get; }

Property Value

ICommand

ToolBarItemCollapseBehavior

The ItemCollapseBehavior for the control when in a ribbon using Simplified layout mode.

public ItemCollapseBehavior ToolBarItemCollapseBehavior { get; set; }

Property Value

ItemCollapseBehavior:

The default value is Default.

ToolBarItemVariantBehavior

The ItemVariantBehavior for the control when in a toolbar, which also applies when in a ribbon using Simplified layout mode.

public ItemVariantBehavior ToolBarItemVariantBehavior { get; set; }

Property Value

ItemVariantBehavior:

The default value is AlwaysSmall.

VariantSize

The VariantSize currently assigned to the control.

public VariantSize VariantSize { get; set; }

Property Value

VariantSize

Remarks

This property should only be manually set when the control is standalone, and not hosted by a bar control.

Methods

ArrangeOverride(Size)

Called to arrange and size the content of a Control object.

protected override Size ArrangeOverride(Size arrangeBounds)
Parameter Type Description
arrangeBounds Size

The computed size that is used to arrange the content.

Returns

Size:

The size of the control.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnCreateAutomationPeer()

Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The type-specific AutomationPeer implementation.

OnItemSpacingPropertyValueChanged(DependencyPropertyChangedEventArgs)

Occurs when the ItemSpacing property value changes.

protected override void OnItemSpacingPropertyValueChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

The event data.

OnItemsChanged(NotifyCollectionChangedEventArgs)

Updates the current selection when an item in the Selector has changed.

protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameter Type Description
e NotifyCollectionChangedEventArgs

The event data.

OnMinItemHeightPropertyValueChanged(DependencyPropertyChangedEventArgs)

Occurs when the MinItemHeight property value changes.

protected override void OnMinItemHeightPropertyValueChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

The event data.

OnMinItemWidthPropertyValueChanged(DependencyPropertyChangedEventArgs)

Occurs when the MinItemWidth property value changes.

protected override void OnMinItemWidthPropertyValueChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

The event data.

OnSelectionChanged(SelectionChangedEventArgs)

Called when the selection changes.

protected override void OnSelectionChanged(SelectionChangedEventArgs e)
Parameter Type Description
e SelectionChangedEventArgs

The event data.

OnUserInterfaceDensityPropertyValueChanged(DependencyPropertyChangedEventArgs)

Occurs when the UserInterfaceDensity property value changes.

protected override void OnUserInterfaceDensityPropertyValueChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

The event data.

PrepareContainerForItemOverride(DependencyObject, object)

Prepares the specified element to display the specified item.

protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameter Type Description
element DependencyObject

The element that is used to display the specified item.

item object

The specified item to display.

ScrollDown()

Scrolls the gallery down a row.

public void ScrollDown()

ScrollUp()

Scrolls the gallery up a row.

public void ScrollUp()

Fields

CanAutoScrollToSelectedItemProperty

Defines the CanAutoScrollToSelectedItem property.

public static readonly DependencyProperty CanAutoScrollToSelectedItemProperty

CollapsedButtonToolTipProperty

Defines the CollapsedButtonToolTip property.

public static readonly DependencyProperty CollapsedButtonToolTipProperty

IsScrollingProperty

Defines the IsScrolling property.

public static readonly DependencyProperty IsScrollingProperty

KeyTipTextProperty

Defines the KeyTipText property.

public static readonly DependencyProperty KeyTipTextProperty

LayoutModeProperty

Defines the LayoutMode property.

public static readonly DependencyProperty LayoutModeProperty

MaxColumnCountProperty

Defines the MaxColumnCount property.

public static readonly DependencyProperty MaxColumnCountProperty

MaxItemsPresenterHeightProperty

Defines the MaxItemsPresenterHeight property.

public static readonly DependencyProperty MaxItemsPresenterHeightProperty

MinLargeColumnCountProperty

Defines the MinLargeColumnCount property.

public static readonly DependencyProperty MinLargeColumnCountProperty

MinMediumColumnCountProperty

Defines the MinMediumColumnCount property.

public static readonly DependencyProperty MinMediumColumnCountProperty

ToolBarItemCollapseBehaviorProperty

Defines the ToolBarItemCollapseBehavior property.

public static readonly DependencyProperty ToolBarItemCollapseBehaviorProperty

ToolBarItemVariantBehaviorProperty

Defines the ToolBarItemVariantBehavior property.

public static readonly DependencyProperty ToolBarItemVariantBehaviorProperty

VariantSizeProperty

Defines the VariantSize property.

public static readonly DependencyProperty VariantSizeProperty

Inherited Members

Extension Methods