In This Article

BarGalleryViewModel Class

Represents a view model for a standard gallery control within a bar control.

public class BarGalleryViewModel : BarGalleryViewModelBase, IHasKey, IHasVariantImages
Inheritance:
object ObservableObjectBase BarKeyedObjectViewModelBase BarGalleryViewModelBase object
Derived:
BarComboBoxViewModel
Implements:
IHasKey IHasVariantImages

Constructors

BarGalleryViewModel()

Initializes a new instance of the class.

public BarGalleryViewModel()

BarGalleryViewModel(string?)

Initializes a new instance of the class with the specified key. The label and key tip text are auto-generated.

public BarGalleryViewModel(string? key)
Parameter Type Description
key string

A string that uniquely identifies the control.

BarGalleryViewModel(string?, IEnumerable?)

Initializes a new instance of the class with the specified key and items. The label and key tip text are auto-generated.

public BarGalleryViewModel(string? key, IEnumerable? items)
Parameter Type Description
key string

A string that uniquely identifies the control.

items IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarGalleryViewModel(string?, string?)

Initializes a new instance of the class with the specified key and label. The key tip text is auto-generated.

public BarGalleryViewModel(string? key, string? label)
Parameter Type Description
key string

A string that uniquely identifies the control.

label string

The text label to display, which is auto-generated from the key if null.

BarGalleryViewModel(string?, string?, IEnumerable?)

Initializes a new instance of the class with the specified key, label, and items. The key tip text is auto-generated.

public BarGalleryViewModel(string? key, string? label, IEnumerable? items)
Parameter Type Description
key string

A string that uniquely identifies the control.

label string

The text label to display, which is auto-generated from the key if null.

items IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarGalleryViewModel(string?, string?, string?)

Initializes a new instance of the class with the specified key, label, and key tip text.

public BarGalleryViewModel(string? key, string? label, string? keyTipText)
Parameter Type Description
key string

A string that uniquely identifies the control.

label string

The text label to display, which is auto-generated from the key if null.

keyTipText string

The key tip text, which is auto-generated from the label if null.

BarGalleryViewModel(string?, string?, string?, IEnumerable?)

Initializes a new instance of the class with the specified key, label, key tip text, and items.

public BarGalleryViewModel(string? key, string? label, string? keyTipText, IEnumerable? items)
Parameter Type Description
key string

A string that uniquely identifies the control.

label string

The text label to display, which is auto-generated from the key if null.

keyTipText string

The key tip text, which is auto-generated from the label if null.

items IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarGalleryViewModel(string?, string?, string?, ICommand?)

Initializes a new instance of the class with the specified key, label, key tip text, and command.

public BarGalleryViewModel(string? key, string? label, string? keyTipText, ICommand? command)
Parameter Type Description
key string

A string that uniquely identifies the control.

label string

The text label to display, which is auto-generated from the command or key if null.

keyTipText string

The key tip text, which is auto-generated from the command or label if null.

command ICommand

The command to attach to the control.

BarGalleryViewModel(string?, string?, string?, ICommand?, IEnumerable?)

Initializes a new instance of the class with the specified key, label, key tip text, command, and items.

public BarGalleryViewModel(string? key, string? label, string? keyTipText, ICommand? command, IEnumerable? items)
Parameter Type Description
key string

A string that uniquely identifies the control.

label string

The text label to display, which is auto-generated from the command or key if null.

keyTipText string

The key tip text, which is auto-generated from the command or label if null.

command ICommand

The command to attach to the control.

items IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarGalleryViewModel(string?, string?, ICommand?)

Initializes a new instance of the class with the specified key, label, and command. The key tip text is auto-generated.

public BarGalleryViewModel(string? key, string? label, ICommand? command)
Parameter Type Description
key string

A string that uniquely identifies the control.

label string

The text label to display, which is auto-generated from the command or key if null.

command ICommand

The command to attach to the control.

BarGalleryViewModel(string?, string?, ICommand?, IEnumerable?)

Initializes a new instance of the class with the specified key, label, command, and items. The key tip text is auto-generated.

public BarGalleryViewModel(string? key, string? label, ICommand? command, IEnumerable? items)
Parameter Type Description
key string

A string that uniquely identifies the control.

label string

The text label to display, which is auto-generated from the command or key if null.

command ICommand

The command to attach to the control.

items IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarGalleryViewModel(string?, ICommand?)

Initializes a new instance of the class with the specified key and command. The label and key tip text are auto-generated.

public BarGalleryViewModel(string? key, ICommand? command)
Parameter Type Description
key string

A string that uniquely identifies the control.

command ICommand

The command to attach to the control.

BarGalleryViewModel(string?, ICommand?, IEnumerable?)

Initializes a new instance of the class with the specified key, command, and items. The label and key tip text are auto-generated.

public BarGalleryViewModel(string? key, ICommand? command, IEnumerable? items)
Parameter Type Description
key string

A string that uniquely identifies the control.

command ICommand

The command to attach to the control.

items IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

Properties

AboveMenuItems

The collection of menu items that appear above the menu gallery in a popup.

public ObservableCollection<object> AboveMenuItems { get; }

Property Value

ObservableCollection<object>

BelowMenuItems

The collection of menu items that below above the menu gallery in a popup.

public ObservableCollection<object> BelowMenuItems { get; }

Property Value

ObservableCollection<object>

CanCategorize

Indicates whether the gallery sorts and displays items by category when an ICollectionView is set to the ItemsSource.

public bool CanCategorize { get; set; }

Property Value

bool:

The default value is true.

CanFilter

Indicates whether the gallery supports filtering of items by category.

public bool CanFilter { get; set; }

Property Value

bool:

The default value is false.

CanRibbonAutoScrollToSelectedItem

Whether to automatically scroll a ribbon gallery to the selected item on selection changes.

public bool CanRibbonAutoScrollToSelectedItem { get; set; }

Property Value

bool:

The default value is false.

CategoryHeaderTemplate

A Avalonia.Controls.Templates.IDataTemplate for category headers when categorization is enabled.

public IDataTemplate? CategoryHeaderTemplate { get; set; }

Property Value

IDataTemplate

CollapsedButtonDescription

The text description to display in screen tips for the gallery when it is rendered as a collapsed button.

public string? CollapsedButtonDescription { get; set; }

Property Value

string

HasCategoryHeaders

Indicates whether the gallery has category headers when categorizing.

public bool HasCategoryHeaders { get; set; }

Property Value

bool:

The default value is true.

IsSelectionSupported

Indicates whether selection is supported by the gallery.

public bool IsSelectionSupported { get; set; }

Property Value

bool:

The default value is true.

Items

The collection of gallery items.

[Content]
public IEnumerable? Items { get; set; }

Property Value

IEnumerable

KeyTipText

The key tip text used to access the control.

public string? KeyTipText { get; set; }

Property Value

string

LargeIcon

The object representing a large icon, generally 32x32 size.

public object? LargeIcon { get; set; }

Property Value

object

MaxMenuColumnCount

The maximum number of columns when in a menu.

public int MaxMenuColumnCount { get; set; }

Property Value

int:

The default value is MaxValue.

MaxRibbonColumnCount

The maximum number of columns when in-ribbon.

public int MaxRibbonColumnCount { get; set; }

Property Value

int:

The default value is 15.

MediumIcon

The object representing a medium icon, generally 24x24 size.

public object? MediumIcon { get; set; }

Property Value

object

MenuResizeMode

A ControlResizeMode that indicates how the popup menu can resize.

public ControlResizeMode MenuResizeMode { get; set; }

Property Value

ControlResizeMode:

The default value is None.

MinLargeRibbonColumnCount

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

public int MinLargeRibbonColumnCount { get; set; }

Property Value

int:

The default value is 5.

MinMediumRibbonColumnCount

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

public int MinMediumRibbonColumnCount { get; set; }

Property Value

int:

The default value is 3.

MinMenuColumnCount

The minimum number of columns when in a menu.

public int MinMenuColumnCount { get; set; }

Property Value

int:

The default value is 1.

PopupOpeningCommand

The ICommand that executes before the gallery's popup is opened, allowing its items to be customized in MVVM scenarios.

public ICommand? PopupOpeningCommand { get; set; }

Property Value

ICommand

SelectedItem

The selected item.

public IBarGalleryItemViewModel? SelectedItem { get; set; }

Property Value

IBarGalleryItemViewModel

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.

UseAccentedItemBorder

Indicates whether to use an accented item border for gallery items, common when they have vibrant content such as color swatches.

public bool UseAccentedItemBorder { get; set; }

Property Value

bool:

The default value is false.

UseMenuItemAppearance

Indicates whether to use a menu item appearance for gallery items, common for single-column menu galleries.

public bool UseMenuItemAppearance { get; set; }

Property Value

bool:

The default value is false.

UseMenuItemIndent

Indicates whether to align gallery items in a menu so that they indent past the menu's icon column.

public bool UseMenuItemIndent { get; set; }

Property Value

bool:

The default value is false.

Methods

CreateCollectionView(IEnumerable<IBarGalleryItemViewModel>, bool)

Creates a ICollectionView for the specified collection of gallery item view models, allowing for possible categorization and filtering.

public static ICollectionView CreateCollectionView(IEnumerable<IBarGalleryItemViewModel> items, bool categorize)
Parameter Type Description
items IEnumerable<IBarGalleryItemViewModel>

The collection of gallery item view models to include in the collection view.

categorize bool

Whether the collection view source should support categorization by including a group description based on Category property values.

Returns

ICollectionView:

The ICollectionView of gallery item view models that was created.

SelectItemByValueMatch<T>(Func<T, bool>?)

Selects an item in the gallery that matches the predicate.

public virtual T? SelectItemByValueMatch<T>(Func<T, bool>? predicate) where T : IBarGalleryItemViewModel
Type Parameters:
T -

The type of IBarGalleryItemViewModel to examine.

Parameter Type Description
predicate Func<T, bool>

A predicate that determines when an item matches criteria.

Returns

T:

The IBarGalleryItemViewModel that was selected, if any.

Inherited Members

Extension Methods