In This Article

BarGalleryBase Class

Represents an abstract base class for a gallery control.

public abstract class BarGalleryBase : Selector
Inheritance:
object Visual UIElement FrameworkElement Control ItemsControl Selector object
Derived:
BarMenuGallery BarMenuGalleryHostBase

Constructors

BarGalleryBase()

Initializes a new instance of the BarGalleryBase class.

protected BarGalleryBase()

Properties

BetweenPreviewDelay

Gets or sets the delay in milliseconds between PreviewedItem updates as a new item is highlighted.

public int BetweenPreviewDelay { get; set; }

Property Value

int:

The delay in milliseconds between PreviewedItem updates as a new item is highlighted. The default value is 0.

CanCloneToRibbonQuickAccessToolBar

Gets or sets whether the control can be cloned to the ribbon quick-access toolbar.

public bool CanCloneToRibbonQuickAccessToolBar { get; set; }

Property Value

bool:

true if the control can be cloned to the ribbon quick-access toolbar; otherwise, false. The default value is true.

CanStopPreviewingOnMouseLeave

Gets whether the gallery can stop previewing when the mouse leaves the control.

protected virtual bool CanStopPreviewingOnMouseLeave { get; }

Property Value

bool:

true if the gallery can stop previewing when the mouse leaves the control; otherwise, false.

Command

Gets or sets the ICommand to execute when a gallery item is selected.

public ICommand Command { get; set; }

Property Value

ICommand:

The ICommand to execute when a gallery item is selected.

CommandTarget

Gets or sets the IInputElement target for the Command.

public IInputElement CommandTarget { get; set; }

Property Value

IInputElement:

The IInputElement target for the Command.

HighlightedItem

Gets the item that is currently highlighted.

public object HighlightedItem { get; }

Property Value

object:

The item that is currently highlighted.

InitialPreviewDelay

Gets or sets the delay in milliseconds for preview mode to begin after an item is highlighted.

public int InitialPreviewDelay { get; set; }

Property Value

int:

The delay in milliseconds for preview mode to begin after an item is highlighted. The default value is 300.

IsSelectionSupported

Gets or sets whether selection is supported.

public bool IsSelectionSupported { get; set; }

Property Value

bool:

true if selection is supported; otherwise, false. The default value is true.

ItemSpacing

Gets or sets the amount of spacing between items.

public double ItemSpacing { get; set; }

Property Value

double:

The amount of spacing between items. The default value is 0.

Key

Gets or sets a string that uniquely identifies the control.

[Localizability(LocalizationCategory.NeverLocalize)]
public string Key { get; set; }

Property Value

string:

A string that uniquely identifies the control.

Label

Gets or sets the text label to display.

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

Property Value

string:

The text label to display.

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.

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.

MinItemHeight

Gets or sets the minimum item height.

public double MinItemHeight { get; set; }

Property Value

double:

The minimum item height. The default value is 16.0.

MinItemWidth

Gets or sets the minimum item width.

public double MinItemWidth { get; set; }

Property Value

double:

The minimum item width. The default value is 16.0.

PreviewedItem

Gets the item that is currently being previewed.

public object PreviewedItem { get; }

Property Value

object:

The item that is currently being previewed.

SmallImageSource

Gets or sets the ImageSource for a small image, generally 16x16 size.

public ImageSource SmallImageSource { get; set; }

Property Value

ImageSource:

The ImageSource for a small image.

Title

Gets or sets the string title, which can override the Label when displayed in screen tips and customization UI.

[Localizability(LocalizationCategory.Title)]
public string Title { get; set; }

Property Value

string:

The string title.

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 is false.

UserInterfaceDensity

Gets or sets a UserInterfaceDensity that indicates how compact or spacious the UI should appear.

public UserInterfaceDensity UserInterfaceDensity { get; set; }

Property Value

UserInterfaceDensity:

A UserInterfaceDensity that indicates how compact or spacious the UI should appear. The default value is Compact.

Methods

ClearContainerForItemOverride(DependencyObject, object)

Returns an item container to the state it was in before PrepareContainerForItemOverride(DependencyObject, object).

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

The item container element.

item object

The data item.

GetContainerForItemOverride()

Creates or identifies the element that is used to display the given item.

protected override DependencyObject GetContainerForItemOverride()

Returns

DependencyObject:

The element that is used to display the given item.

IsItemItsOwnContainerOverride(object)

Determines if the specified item is (or is eligible to be) its own container.

protected override bool IsItemItsOwnContainerOverride(object item)
Parameter Type Description
item object

The item to check.

Returns

bool:

true if the item is (or is eligible to be) its own container; otherwise, false.

OnHighlightedItemChanged(RoutedEventArgs)

Occurs after the HighlightedItem property has changed.

protected virtual void OnHighlightedItemChanged(RoutedEventArgs e)
Parameter Type Description
e RoutedEventArgs

The RoutedEventArgs that contains the event data.

OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)

Called when the IsKeyboardFocusWithin property has changed.

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

The event data.

OnItemSpacingPropertyValueChanged(DependencyPropertyChangedEventArgs)

Occurs when the ItemSpacing property value changes.

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

The System.Windows.DependencyPropertyChangedEventArgs containing data related to this event.

OnMinItemHeightPropertyValueChanged(DependencyPropertyChangedEventArgs)

Occurs when the MinItemHeight property value changes.

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

The System.Windows.DependencyPropertyChangedEventArgs containing data related to this event.

OnMinItemWidthPropertyValueChanged(DependencyPropertyChangedEventArgs)

Occurs when the MinItemWidth property value changes.

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

The System.Windows.DependencyPropertyChangedEventArgs containing data related to this event.

OnMouseLeave(MouseEventArgs)

Invoked when an unhandled System.Windows.Input.Mouse.MouseLeave attached event is raised on this element. Implement this method to add class handling for this event.

protected override void OnMouseLeave(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

The MouseEventArgs that contains the event data.

OnMouseMove(MouseEventArgs)

Invoked when an unhandled System.Windows.Input.Mouse.MouseMove attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected override void OnMouseMove(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

The MouseEventArgs that contains 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 virtual void OnUserInterfaceDensityPropertyValueChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

The System.Windows.DependencyPropertyChangedEventArgs containing data related to this event.

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.

ScrollToSelectedItem(bool)

Scrolls the gallery to the selected item.

public void ScrollToSelectedItem(bool canFocus)
Parameter Type Description
canFocus bool

Whether to also focus the selected gallery item.

ToString()

Returns the string representation of this object.

public override string ToString()

Returns

string:

The string representation of this object.

Events

HighlightedItemChanged

Occurs after the HighlightedItem property has changed.

public event RoutedEventHandler HighlightedItemChanged

Event Type

RoutedEventHandler

Fields

BetweenPreviewDelayProperty

Identifies the BetweenPreviewDelay dependency property. This field is read-only.

public static readonly DependencyProperty BetweenPreviewDelayProperty

CanCloneToRibbonQuickAccessToolBarProperty

Identifies the CanCloneToRibbonQuickAccessToolBar dependency property. This field is read-only.

public static readonly DependencyProperty CanCloneToRibbonQuickAccessToolBarProperty

CommandProperty

Identifies the Command dependency property. This field is read-only.

public static readonly DependencyProperty CommandProperty

CommandTargetProperty

Identifies the CommandTarget dependency property. This field is read-only.

public static readonly DependencyProperty CommandTargetProperty

HighlightedItemChangedEvent

Identifies the HighlightedItemChanged routed event. This field is read-only.

public static readonly RoutedEvent HighlightedItemChangedEvent

HighlightedItemProperty

Identifies the HighlightedItem dependency property. This field is read-only.

public static readonly DependencyProperty HighlightedItemProperty

InitialPreviewDelayProperty

Identifies the InitialPreviewDelay dependency property. This field is read-only.

public static readonly DependencyProperty InitialPreviewDelayProperty

IsSelectionSupportedProperty

Identifies the IsSelectionSupported dependency property. This field is read-only.

public static readonly DependencyProperty IsSelectionSupportedProperty

ItemSpacingProperty

Identifies the ItemSpacing dependency property. This field is read-only.

public static readonly DependencyProperty ItemSpacingProperty

KeyProperty

Identifies the Key dependency property. This field is read-only.

public static readonly DependencyProperty KeyProperty

LabelProperty

Identifies the Label dependency property. This field is read-only.

public static readonly DependencyProperty LabelProperty

LargeImageSourceProperty

Identifies the LargeImageSource dependency property. This field is read-only.

public static readonly DependencyProperty LargeImageSourceProperty

MediumImageSourceProperty

Identifies the MediumImageSource dependency property. This field is read-only.

public static readonly DependencyProperty MediumImageSourceProperty

MinItemHeightProperty

Identifies the MinItemHeight dependency property. This field is read-only.

public static readonly DependencyProperty MinItemHeightProperty

MinItemWidthProperty

Identifies the MinItemWidth dependency property. This field is read-only.

public static readonly DependencyProperty MinItemWidthProperty

PreviewedItemProperty

Identifies the PreviewedItem dependency property. This field is read-only.

public static readonly DependencyProperty PreviewedItemProperty

SmallImageSourceProperty

Identifies the SmallImageSource dependency property. This field is read-only.

public static readonly DependencyProperty SmallImageSourceProperty

TitleProperty

Identifies the Title dependency property. This field is read-only.

public static readonly DependencyProperty TitleProperty

UseAccentedItemBorderProperty

Identifies the UseAccentedItemBorder dependency property. This field is read-only.

public static readonly DependencyProperty UseAccentedItemBorderProperty

UserInterfaceDensityProperty

Identifies the UserInterfaceDensity dependency property. This field is read-only.

public static readonly DependencyProperty UserInterfaceDensityProperty