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 |
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 |
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 |
keyTipText | string | The key tip text, which is auto-generated from the |
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 |
keyTipText | string | The key tip text, which is auto-generated from the |
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 |
keyTipText | string | The key tip text, which is auto-generated from the |
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 |
keyTipText | string | The key tip text, which is auto-generated from the |
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 | 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 | 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. |
BarGalleryViewModel(RoutedCommand)
Initializes a new instance of the class with the specified RoutedCommand, also used to auto-generate a key, label, and key tip text.
public BarGalleryViewModel(RoutedCommand routedCommand)
Parameter | Type | Description |
---|---|---|
routedCommand | RoutedCommand | The command to attach to the control. |
BarGalleryViewModel(RoutedCommand, IEnumerable)
Initializes a new instance of the class with the specified items and RoutedCommand, also used to auto-generate a key, label, and key tip text.
public BarGalleryViewModel(RoutedCommand routedCommand, IEnumerable items)
Parameter | Type | Description |
---|---|---|
routedCommand | RoutedCommand | The command to attach to the control. |
items | IEnumerable | The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel. |
Properties
AboveMenuItems
Gets the collection of menu items that appear above the menu gallery in a popup.
public ObservableCollection<object> AboveMenuItems { get; }
Property Value
- ObservableCollection<object>:
The collection of menu items that appear above the menu gallery in a popup.
BelowMenuItems
Gets the collection of menu items that below above the menu gallery in a popup.
public ObservableCollection<object> BelowMenuItems { get; }
Property Value
- ObservableCollection<object>:
The collection of menu items that below above the menu gallery in a popup.
CanCategorize
Gets or sets whether the gallery sorts and displays items by category when an System.ComponentModel.ICollectionView is set to the ItemsSource
.
public bool CanCategorize { get; set; }
Property Value
- bool:
true
if the gallery sorts and displays items by category when an System.ComponentModel.ICollectionView is set to theItemsSource
; otherwise,false
. The default value istrue
.
CanFilter
Gets or sets whether the gallery supports filtering of items by category.
public bool CanFilter { get; set; }
Property Value
- bool:
true
if the gallery supports filtering of items by category; otherwise,false
. The default value isfalse
.
CanRibbonAutoScrollToSelectedItem
Gets or sets whether to automatically scroll a ribbon gallery to the selected item on selection changes.
public bool CanRibbonAutoScrollToSelectedItem { get; set; }
Property Value
- bool:
true
if the ribbon gallery selected item should automatically be scrolled into view on selection changes; otherwise,false
. The default value isfalse
.
CategoryHeaderTemplate
Gets or sets a DataTemplate for category headers when categorization is enabled.
public DataTemplate CategoryHeaderTemplate { get; set; }
Property Value
- DataTemplate:
A DataTemplate for category headers when categorization is enabled.
CollapsedButtonDescription
Gets or sets 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:
The text description to display in screen tips for the gallery when it is rendered as a collapsed button.
HasCategoryHeaders
Gets or sets whether the gallery has category headers when categorizing.
public bool HasCategoryHeaders { get; set; }
Property Value
- bool:
true
if the gallery has category headers when categorizing; otherwise,false
. The default value istrue
.
IsSelectionSupported
Gets or sets whether selection is supported by the gallery.
public bool IsSelectionSupported { get; set; }
Property Value
- bool:
true
if selection is supported by the gallery; otherwise,false
. The default value istrue
.
IsSynchronizedWithCurrentItem
Gets or sets whether the gallery control should keep its SelectedItem
property synchronized with the current item in its Items
property.
public bool? IsSynchronizedWithCurrentItem { get; set; }
Property Value
- bool?:
true
if theSelectedItem
is always synchronized with the current item in theItems
;false
if theSelectedItem
is never synchronized with the current item;null
if theSelectedItem
is synchronized with the current item only if the gallery uses aCollectionView
. The default value isnull
.
Items
Gets or sets the collection of gallery items.
KeyTipText
Gets or sets the key tip text used to access the control.
public string KeyTipText { get; set; }
Property Value
- string:
The key tip text used to access the control.
LargeImageSource
Gets or sets the ImageSource for a large image, generally 32x32
size.
public ImageSource LargeImageSource { get; set; }
Property Value
- ImageSource:
The ImageSource for a large image.
MaxMenuColumnCount
Gets or sets the maximum number of columns when in a menu.
public int MaxMenuColumnCount { get; set; }
Property Value
MaxRibbonColumnCount
Gets or sets the maximum number of columns when in-ribbon.
public int MaxRibbonColumnCount { get; set; }
Property Value
- int:
The maximum number of columns when in-ribbon. The default value is
15
.
MediumImageSource
Gets or sets the ImageSource for a medium image, generally 24x24
size.
public ImageSource MediumImageSource { get; set; }
Property Value
- ImageSource:
The ImageSource for a medium image.
MenuResizeMode
Gets or sets a ControlResizeMode that indicates how the popup menu can resize.
public ControlResizeMode MenuResizeMode { get; set; }
Property Value
- ControlResizeMode:
A ControlResizeMode that indicates how the popup menu can resize. The default value is None.
MinLargeRibbonColumnCount
Gets or sets the minimum number of columns to use when in-ribbon with a Large variant size.
public int MinLargeRibbonColumnCount { get; set; }
Property Value
MinMediumRibbonColumnCount
Gets or sets the minimum number of columns to use when in-ribbon with a Medium variant size.
public int MinMediumRibbonColumnCount { get; set; }
Property Value
MinMenuColumnCount
Gets or sets the minimum number of columns when in a menu.
public int MinMenuColumnCount { get; set; }
Property Value
- int:
The minimum number of columns when in a menu. The default value is
1
.
PopupOpeningCommand
Gets or sets 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
SelectedItem
Gets or sets the selected item.
public IBarGalleryItemViewModel SelectedItem { get; set; }
Property Value
- IBarGalleryItemViewModel:
The selected item.
ToolBarItemCollapseBehavior
Gets or sets the ItemCollapseBehavior for the control when in a ribbon using Simplified layout mode.
public ItemCollapseBehavior ToolBarItemCollapseBehavior { get; set; }
Property Value
- ItemCollapseBehavior:
The ItemCollapseBehavior for the control when in a ribbon using Simplified layout mode. The default value is
Default
.
ToolBarItemVariantBehavior
Gets or sets 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 ItemVariantBehavior for the control when in a toolbar, which also applies when in a ribbon using Simplified layout mode. The default value is
AlwaysSmall
.
UseAccentedItemBorder
Gets or sets 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:
true
if an accented item border should be used for gallery items; otherwise,false
. The default value isfalse
.
UseMenuItemAppearance
Gets or sets whether to use a menu item appearance for gallery items, common for single-column menu galleries.
public bool UseMenuItemAppearance { get; set; }
Property Value
- bool:
true
if gallery items should use a menu item appearance; otherwise,false
. The default value isfalse
.
UseMenuItemIndent
Gets or sets 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:
true
if gallery items should be indented past the menu's icon column; otherwise,false
. The default value isfalse
.
Methods
CreateCollectionViewSource(IEnumerable<IBarGalleryItemViewModel>, bool)
Creates a CollectionViewSource for the specified collection of gallery item view models, allowing for possible categorization and filtering.
public static CollectionViewSource CreateCollectionViewSource(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
- CollectionViewSource:
The CollectionViewSource 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 BarGalleryViewModelBase that was selected.
Inherited Members
- BarGalleryViewModelBase.AreSurroundingSeparatorsAllowed
- BarGalleryViewModelBase.CanCloneToRibbonQuickAccessToolBar
- BarGalleryViewModelBase.Command
- BarGalleryViewModelBase.ItemContainerStyle
- BarGalleryViewModelBase.ItemContainerStyleSelector
- BarGalleryViewModelBase.ItemSpacing
- BarGalleryViewModelBase.ItemTemplate
- BarGalleryViewModelBase.ItemTemplateSelector
- BarGalleryViewModelBase.Label
- BarGalleryViewModelBase.MinItemHeight
- BarGalleryViewModelBase.MinItemWidth
- BarGalleryViewModelBase.SmallImageSource
- BarGalleryViewModelBase.Title
- BarKeyedObjectViewModelBase.ToString()
- BarKeyedObjectViewModelBase.Key
- ObservableObjectBase.NotifyPropertyChanged(string)
- ObservableObjectBase.OnPropertyChanged(PropertyChangedEventArgs)
- ObservableObjectBase.SetProperty<T>(ref T, T, string)
- ObservableObjectBase.PropertyChanged
- object.GetType()
- object.MemberwiseClone()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()