private void OnRibbonGalleryCategoriesPanelLoaded(object sender, RoutedEventArgs e) { RibbonGallery gallery = this.Gallery; if (gallery != null) { #if IN_RIBBON_GALLERY if (gallery.IsInInRibbonGalleryMode()) { return; } #endif RibbonHelper.InitializeStarLayoutManager(this); } }
// There are two different scenarios: // 1. In InRibbonGalleryMode where the gallery is shown within Ribbon via InRibbonGallery and Arrange becomes responsibility // of InRibbonGalleryModeMeasureOverride. // 2. Popup mode : it's the common and RealArrangeOverride which is the common case of RibbonGallery hosted normally in Popup // weather it belongs to InRibbonGallery or any other control containing Gallery like RibbonComboBox/RibbonMenuButton etc. protected override Size ArrangeOverride(Size finalSize) { RibbonGallery gallery = Gallery; #if IN_RIBBON_GALLERY if (gallery != null && gallery.IsInInRibbonGalleryMode()) { return(InRibbonGalleryModeArrangeOverride(finalSize)); } else { #endif return(RealArrangeOverride(finalSize)); #if IN_RIBBON_GALLERY } #endif }
// There are three different scenarios: // 1. In InRibbonGalleryMode where the gallery is shown within Ribbon via InRibbonGallery and Measure becomes responsibility // of InRibbonGalleryModeMeasureOverride. // 2. Popup mode : it's the common and RealMeasureOverride which is the common case of RibbonGallery hosted normally in Popup // Weather it belongs to InRibbonGallery or any other control containing Gallery like RibbonComboBox/RibbonMenuButton etc. // 3. Popup mode also utilizes AutoPass to be understood by hosting Control like RibbonComboBox/RibbonMenuButton etc. protected override Size MeasureOverride(Size availableSize) { RibbonGallery gallery = Gallery; #if IN_RIBBON_GALLERY if (gallery != null && gallery.IsInInRibbonGalleryMode()) { return(InRibbonGalleryModeMeasureOverride(availableSize)); } else { #endif return(RealMeasureOverride(availableSize)); #if IN_RIBBON_GALLERY } #endif }