How do I add Galleries to my Ribbon?

How do I add Galleries to my Ribbon?

  • Comments 2

RibbonGallery is a new metaphor introduced as part of the Ribbon UI. It is a control that visualizes a list of RibbonGalleryItems that are grouped into RibbonGalleryCategories. RibbonGallery is typically used to visualize a set of related choices that are best expressed visually. Using the Ribbon Controls Library the RibbonGallery can be hosted within any of the following controls.

§  RibbonMenuButton

§  RibbonSplitButton

§  RibbonComboBox

§  RibbonMenuItem

§  RibbonSplitMenuItem

§  RibbonApplicationMenuItem

§  RibbonApplicationSplitMenuItem

Apart from being hosted in a drop-down control such as the ones listed above, the other popular use is as a standalone InRibbonGallery control. This control is not supported in the current release of Ribbon Controls Library, but will likely be supported in the future. The Styles Group in Microsoft Word has an InRibbonGallery and a Change Styles RibbonMenuButton hosting a variety of other Galleries. The attached sample demonstrates an implementation of this Group.

 

 

Notice the use of Galleries within each RibbonMenuItem and the uses of DataTemplates and/or HierarchicalDataTemplates to visualize the two levels in the hierarchy, RibbonGalleryCategory and RibbonGalleryItem. Also note the use of the MaxColumnCount property. The RibbonGallery control supports multi-column layout. The MinColumnCount and MaxColumnCount properties allow an app author to specify the column range and thus when the Popup containing the RibbonGallery is resized, the contents are laid out to match these constraints. When the Popup is opened the Gallery is laid out to its MinColumnCount dimensions. The resizablility of the parent control is specified using the CanUserResizeHorizontally and CanUserResizeVertically properties. And lastly the RibbonGalleryCategory’s HeaderVisibility is configurable. For instance the Style Set Gallery does not show Category Header whereas the Colors and Fonts Galleries do.

 

Attachment: WpfRibbonApplication_Word.zip
  • RibbonCommand is gone now? What to use instead?

  • @GUIdev: You can use any ICommand implementation (RoutedCommand or your custom implementation). The attached sample in this post also illustrates the use of it.

Page 1 of 1 (2 items)