In This Article

RibbonGallery Class

Represents a gallery control, for use within a Ribbon.

[PseudoClasses(new string[] { ":layout-mode-classic", ":layout-mode-simplified" })]
[TemplatePart(Name = "PART_CollapsedButton", Type = typeof(BarPopupButton))]
[TemplatePart(Name = "PART_ExpandedElement", Type = typeof(Control))]
[TemplatePart(Name = "PART_MoreButton", Type = typeof(RibbonGalleryMoreButton))]
public class RibbonGallery : BarMenuGalleryHostBase, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, IChildIndexProvider, ICommandSource, IOrientedElement
Inheritance:
object AvaloniaObject Animatable StyledElement Visual Layoutable Interactive InputElement Control TemplatedControl ItemsControl SelectingItemsControl BarGalleryBase BarMenuGalleryHostBase object
Implements:
IDataContextProvider ILogical IThemeVariantHost IResourceHost IResourceNode IStyleHost ISetLogicalParent ISetInheritanceParent IStyleable INamed IInputElement IDataTemplateHost ISetterValue IChildIndexProvider ICommandSource IOrientedElement

Constructors

RibbonGallery()

Initializes an instance of the class.

public RibbonGallery()

Properties

CanAutoScrollToSelectedItem

Whether to automatically scroll to the selected item on selection changes.

public bool CanAutoScrollToSelectedItem { get; set; }

Property Value

bool:

The default value is false.

CollapsedButtonToolTip

The tooltip for the collapsed button.

public object? CollapsedButtonToolTip { get; set; }

Property Value

object

IsScrolling

Whether the gallery is currently being scrolled.

public bool IsScrolling { get; }

Property Value

bool

KeyTipText

The key tip text used to access the control.

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:

The default value is Classic.

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:

The default value is PositiveInfinity.

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. This property should only be manually set when the control is standalone, and not hosted by a bar control.

public VariantSize VariantSize { get; set; }

Property Value

VariantSize:

The default value is Small.

Methods

ArrangeOverride(Size)

Positions child elements as part of a layout pass.

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

Returns

Size:

The actual size used.

OnApplyTemplate(TemplateAppliedEventArgs)

Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.

protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
Parameter Type Description
e TemplateAppliedEventArgs

The event args.

OnCreateAutomationPeer()

Returns a new, type-specific Avalonia.Automation.Peers.AutomationPeer implementation for the control.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The type-specific Avalonia.Automation.Peers.AutomationPeer implementation.

OnItemSpacingPropertyValueChanged(AvaloniaPropertyChangedEventArgs)

Occurs when the ItemSpacing property value changes.

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

The Avalonia.AvaloniaPropertyChangedEventArgs containing data related to this event.

OnMinItemHeightPropertyValueChanged(AvaloniaPropertyChangedEventArgs)

Occurs when the MinItemHeight property value changes.

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

The Avalonia.AvaloniaPropertyChangedEventArgs containing data related to this event.

OnMinItemWidthPropertyValueChanged(AvaloniaPropertyChangedEventArgs)

Occurs when the MinItemWidth property value changes.

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

The Avalonia.AvaloniaPropertyChangedEventArgs containing data related to this event.

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 StyledProperty<bool> CanAutoScrollToSelectedItemProperty

CollapsedButtonToolTipProperty

Defines the CollapsedButtonToolTip property.

public static readonly StyledProperty<object?> CollapsedButtonToolTipProperty

IsScrollingProperty

Defines the IsScrolling property.

public static readonly StyledProperty<bool> IsScrollingProperty

KeyTipTextProperty

Defines the KeyTipText property.

public static readonly StyledProperty<string?> KeyTipTextProperty

LayoutModeProperty

Defines the LayoutMode property.

public static readonly StyledProperty<RibbonLayoutMode> LayoutModeProperty

MaxColumnCountProperty

Defines the MaxColumnCount property.

public static readonly StyledProperty<int> MaxColumnCountProperty

MaxItemsPresenterHeightProperty

Defines the MaxItemsPresenterHeight property.

public static readonly StyledProperty<double> MaxItemsPresenterHeightProperty

MinLargeColumnCountProperty

Defines the MinLargeColumnCount property.

public static readonly StyledProperty<int> MinLargeColumnCountProperty

MinMediumColumnCountProperty

Defines the MinMediumColumnCount property.

public static readonly StyledProperty<int> MinMediumColumnCountProperty

ToolBarItemCollapseBehaviorProperty

Defines the ToolBarItemCollapseBehavior property.

public static readonly StyledProperty<ItemCollapseBehavior> ToolBarItemCollapseBehaviorProperty

ToolBarItemVariantBehaviorProperty

Defines the ToolBarItemVariantBehavior property.

public static readonly StyledProperty<ItemVariantBehavior> ToolBarItemVariantBehaviorProperty

VariantSizeProperty

Defines the VariantSize property.

public static readonly StyledProperty<VariantSize> VariantSizeProperty

Inherited Members

Extension Methods