RibbonGallery Class
Represents an in-Ribbon gallery control.
[TemplatePart(Name = "PART_ItemsHost", Type = typeof(ItemsPresenter))]
[TemplatePart(Name = "PART_PopupButton", Type = typeof(PopupButton))]
public class RibbonGallery : GalleryBase, IKeyTipTarget, ILogicalParent, IVariantControl
- Inheritance:
- object Visual UIElement FrameworkElement Control ItemsControl ItemsControlBase GalleryBase object
- Implements:
- IKeyTipTarget ILogicalParent IVariantControl
Remarks
For detailed documentation on this control's features and how to use them, please see the RibbonGallery documentation topic.
Constructors
RibbonGallery()
Initializes an instance of the class.
public RibbonGallery()
Properties
ColumnCount
Gets the number of columns that are currently displayed in the in-ribbon gallery.
public int ColumnCount { get; }
Property Value
- int:
The maximum number of columns that are currently displayed in the in-ribbon gallery.
IsCollapsed
Gets whether the gallery is collapsed to a popup button.
public bool IsCollapsed { get; }
Property Value
- bool:
true
if the gallery is collapsed to a popup button; otherwise,false
.
Remarks
When collapsed, the gallery items can be viewed in a popup by clicking the button that represents the gallery.
IsPopupOpen
Gets or sets whether a child popup is open.
public bool IsPopupOpen { get; set; }
Property Value
- bool:
true
if the a child popup is open; otherwise,false
.
LargeVariantColumnCount
Gets or sets the maximum number of columns that can be displayed in an in-ribbon gallery when in a Group with a Medium
variant size,
which is also the minimum number of columns that can be displayed when in a Group with a Large
variant size.
public int LargeVariantColumnCount { get; set; }
Property Value
- int:
The maximum number of columns that can be displayed in an in-ribbon gallery when in a Group with a
Medium
variant size, which is also the minimum number of columns that can be displayed when in a Group with aLarge
variant size. The default value is5
.
Remarks
Set the MediumVariantColumnCount and LargeVariantColumnCount properties to the same value
to ensure that an in-ribbon gallery never expands when in a Group with a Medium
variant size.
LogicalChildren
Gets an enumerator for the logical child objects of the ItemsControl object.
protected override IEnumerator LogicalChildren { get; }
Property Value
- IEnumerator:
An enumerator for the logical child objects of the ItemsControl object.
MediumVariantColumnCount
Gets or sets the minimum number of columns that can be displayed in an in-ribbon gallery when in a Group with a Medium
variant size.
public int MediumVariantColumnCount { get; set; }
Property Value
- int:
The minimum number of columns that can be displayed in an in-ribbon gallery when in a Group with a
Medium
variant size. The default value is3
.
Remarks
Set the MediumVariantColumnCount and LargeVariantColumnCount properties to the same value
to ensure that an in-ribbon gallery never expands when in a Group with a Medium
variant size.
PopupContent
Gets or sets the content that is displayed on the popup for the gallery.
public object PopupContent { get; set; }
Property Value
- object:
The content that is displayed on the popup for the gallery.
Remarks
The popup content must contain a PopupGallery somewhere in it that binds to the same items as the RibbonGallery.
PopupContentTemplate
Gets or sets the DataTemplate to use for the PopupContent.
public DataTemplate PopupContentTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for the PopupContent.
Remarks
This property is only really useful if your popup content is a data object and not a UI element.
PopupContentTemplateSelector
Gets or sets the DataTemplateSelector to use for the PopupContent.
public DataTemplateSelector PopupContentTemplateSelector { get; set; }
Property Value
- DataTemplateSelector:
The DataTemplateSelector to use for the PopupContent.
Remarks
This property is only really useful if your popup content is a data object and not a UI element.
PopupResizeMode
Gets or sets a ControlResizeMode that specifies the popup's resizing capabilities.
public ControlResizeMode PopupResizeMode { get; set; }
Property Value
- ControlResizeMode:
A ControlResizeMode that specifies the popup's resizing capabilities. The default value is
ControlResizeMode.Both
.
VariantBehavior
Gets or sets a RibbonGalleryVariantBehavior that specifies how the gallery renders itself based on the current value of the VariantSize property.
public RibbonGalleryVariantBehavior VariantBehavior { get; set; }
Property Value
- RibbonGalleryVariantBehavior:
A RibbonGalleryVariantBehavior that specifies how the gallery renders itself based on the current value of the VariantSize property. The default value of this property is
RibbonGalleryVariantBehavior.Default
.
Remarks
See the RibbonGalleryVariantBehavior description for details on how various settings of this property affect the control's layout.
Methods
MeasureOverride(Size)
When overridden in a derived class, measures the size in layout required for child elements and determines a size for the FrameworkElement-derived class.
protected override Size MeasureOverride(Size constraint)
Parameter | Type | Description |
---|---|---|
constraint | Size | The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available. |
Returns
- Size:
The size that this element determines it needs during layout, based on its calculations of child element sizes.
OnItemsChanged(NotifyCollectionChangedEventArgs)
Invoked when the Items
property changes.
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | NotifyCollectionChangedEventArgs | A NotifyCollectionChangedEventArgs that contains the event data. |
OnKeyTipAccessed(string)
Called when key tip access text for the control is typed by the end user.
protected override bool OnKeyTipAccessed(string keyTipAccessText)
Parameter | Type | Description |
---|---|---|
keyTipAccessText | string | The key tip access text that was typed. |
Returns
- bool:
true
if an action was executed that should stop key tip mode; otherwise,false
.
Remarks
Implementations of this method should either execute the action associated with the control or move focus to the control so that the end user can take further action such as in a menu.
OnPopupClosed()
Raises the PopupClosedEvent.
protected virtual void OnPopupClosed()
OnPopupOpened()
Raises the PopupOpenedEvent.
protected virtual void OnPopupOpened()
OnPopupOpening()
Raises the PopupOpeningEvent.
protected virtual bool OnPopupOpening()
Returns
- bool:
true
if the popup opening should be allowed to open; otherwise,false
.
OnSelectedItemChanged(object, object)
Occurs when the SelectedItem property is changed and raises the SelectedItemChanged event.
protected override void OnSelectedItemChanged(object oldSelectedItem, object newSelectedItem)
Parameter | Type | Description |
---|---|---|
oldSelectedItem | object | The old SelectedItem value. |
newSelectedItem | object | The new SelectedItem value. |
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 System.Windows.DependencyObject that is the wrapper element. |
item | object | The item that is being wrapped. |
Events
PopupClosed
Occurs when the value of the IsPopupOpen property changes from true
to false
.
PopupOpened
Occurs when the value of the IsPopupOpen property changes from false
to true
.
PopupOpening
Occurs before the value of the IsPopupOpen property changes from false
to true
.
public event EventHandler<CancelRoutedEventArgs> PopupOpening
Event Type
Fields
ColumnCountProperty
Identifies the ColumnCount dependency property. This field is read-only.
public static readonly DependencyProperty ColumnCountProperty
IsCollapsedProperty
Identifies the IsCollapsed dependency property. This field is read-only.
public static readonly DependencyProperty IsCollapsedProperty
IsPopupOpenProperty
Identifies the IsPopupOpen dependency property. This field is read-only.
public static readonly DependencyProperty IsPopupOpenProperty
LargeVariantColumnCountProperty
Identifies the LargeVariantColumnCount dependency property. This field is read-only.
public static readonly DependencyProperty LargeVariantColumnCountProperty
MediumVariantColumnCountProperty
Identifies the MediumVariantColumnCount dependency property. This field is read-only.
public static readonly DependencyProperty MediumVariantColumnCountProperty
PopupClosedEvent
Identifies the PopupClosed routed event. This field is read-only.
public static readonly RoutedEvent PopupClosedEvent
PopupContentProperty
Identifies the PopupContent dependency property. This field is read-only.
public static readonly DependencyProperty PopupContentProperty
PopupContentTemplateProperty
Identifies the PopupContentTemplate dependency property. This field is read-only.
public static readonly DependencyProperty PopupContentTemplateProperty
PopupContentTemplateSelectorProperty
Identifies the PopupContentTemplateSelector dependency property. This field is read-only.
public static readonly DependencyProperty PopupContentTemplateSelectorProperty
PopupOpenedEvent
Identifies the PopupOpened routed event. This field is read-only.
public static readonly RoutedEvent PopupOpenedEvent
PopupOpeningEvent
Identifies the PopupOpening routed event. This field is read-only.
public static readonly RoutedEvent PopupOpeningEvent
PopupResizeModeProperty
Identifies the PopupResizeMode dependency property. This field is read-only.
public static readonly DependencyProperty PopupResizeModeProperty
VariantBehaviorProperty
Identifies the VariantBehavior dependency property. This field is read-only.
public static readonly DependencyProperty VariantBehaviorProperty
Inherited Members
- GalleryBase.ActiveItemChangedEvent
- GalleryBase.ItemClickEvent
- GalleryBase.SelectedItemChangedEvent
- GalleryBase.ActiveItemProperty
- GalleryBase.IsPreviewEnabledProperty
- GalleryBase.IsSelectionHighlightVisibleProperty
- GalleryBase.ItemSizeProperty
- GalleryBase.SelectedItemProperty
- GalleryBase.ZoomedInItemTemplateProperty
- GalleryBase.ZoomedInItemTemplateSelectorProperty
- GalleryBase.CoerceCommandParameter(DependencyObject, object)
- GalleryBase.ExtractDataItem(object)
- GalleryBase.GetContainerForItemOverride()
- GalleryBase.IsItemItsOwnContainerOverride(object)
- GalleryBase.OnActiveItemChanged(object, object)
- GalleryBase.OnClick(ExecuteRoutedEventArgs)
- GalleryBase.OnItemClick(ObjectItemRoutedEventArgs)
- GalleryBase.OnItemTemplateChanged(DataTemplate, DataTemplate)
- GalleryBase.OnMouseLeave(MouseEventArgs)
- GalleryBase.UpdateCanExecute()
- GalleryBase.ActiveItem
- GalleryBase.IsPreviewEnabled
- GalleryBase.IsSelectionHighlightVisible
- GalleryBase.ItemSize
- GalleryBase.SelectedItem
- GalleryBase.ZoomedInItemTemplate
- GalleryBase.ZoomedInItemTemplateSelector
- GalleryBase.ActiveItemChanged
- GalleryBase.ItemClick
- GalleryBase.SelectedItemChanged
- ItemsControlBase.ClickEvent
- ItemsControlBase.PreviewClickEvent
- ItemsControlBase.ScreenTipClosingEvent
- ItemsControlBase.ScreenTipOpeningEvent
- ItemsControlBase.CommandProperty
- ItemsControlBase.CommandParameterProperty
- ItemsControlBase.CommandTargetProperty
- ItemsControlBase.ContextProperty
- ItemsControlBase.HasImageProperty
- ItemsControlBase.HasLabelProperty
- ItemsControlBase.IdProperty
- ItemsControlBase.ImageSourceLargeProperty
- ItemsControlBase.ImageSourceSmallProperty
- ItemsControlBase.IsHighlightedProperty
- ItemsControlBase.KeyTipAccessTextProperty
- ItemsControlBase.LabelProperty
- ItemsControlBase.ScreenTipDescriptionProperty
- ItemsControlBase.ScreenTipFooterProperty
- ItemsControlBase.ScreenTipHeaderProperty
- ItemsControlBase.ScreenTipHelpUriProperty
- ItemsControlBase.ScreenTipImageSourceProperty
- ItemsControlBase.VariantSizeProperty
- ItemsControlBase.OnCommandChanged(ICommand, ICommand)
- ItemsControlBase.OnContextChanged(ControlContext, ControlContext)
- ItemsControlBase.OnCreateAutomationPeer()
- ItemsControlBase.OnPreviewClick(ExecuteRoutedEventArgs)
- ItemsControlBase.OnPropertyChanged(DependencyPropertyChangedEventArgs)
- ItemsControlBase.OnScreenTipClosing(RoutedEventArgs)
- ItemsControlBase.OnScreenTipOpening(RoutedEventArgs)
- ItemsControlBase.OnValidateItems(IList)
- ItemsControlBase.OnVariantSizeChanged(VariantSize, VariantSize)
- ItemsControlBase.RaiseClickEvent(ExecuteRoutedEventArgs)
- ItemsControlBase.CanUpdateCanExecuteWhenHidden
- ItemsControlBase.Command
- ItemsControlBase.CommandParameter
- ItemsControlBase.CommandTarget
- ItemsControlBase.Context
- ItemsControlBase.HasImage
- ItemsControlBase.HasLabel
- ItemsControlBase.Id
- ItemsControlBase.ImageSourceLarge
- ItemsControlBase.ImageSourceSmall
- ItemsControlBase.IsHighlighted
- ItemsControlBase.KeyTipAccessText
- ItemsControlBase.Label
- ItemsControlBase.ScreenTipDescription
- ItemsControlBase.ScreenTipFooter
- ItemsControlBase.ScreenTipHeader
- ItemsControlBase.ScreenTipHelpUri
- ItemsControlBase.ScreenTipImageSource
- ItemsControlBase.VariantSize
- ItemsControlBase.Click
- ItemsControlBase.PreviewClick
- ItemsControlBase.ScreenTipClosing
- ItemsControlBase.ScreenTipOpening