Microsoft.Windows.Controls.Ribbon.RibbonMenuButton.OnHasGalleryChanged C# (CSharp) Метод

OnHasGalleryChanged() приватный статический Метод

private static OnHasGalleryChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
d System.Windows.DependencyObject
e System.Windows.DependencyPropertyChangedEventArgs
Результат void
        private static void OnHasGalleryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            d.CoerceValue(CanUserResizeHorizontallyProperty);
            d.CoerceValue(CanUserResizeVerticallyProperty);
            d.CoerceValue(DropDownHeightProperty);

            RibbonMenuButton menuButton = (RibbonMenuButton)d;
            if (menuButton.IsDropDownOpen)
            {
                // First time the dropdown opens, HasGallery is always false
                // because item container generation never happened yet and hence
                // it ignores DropDownHeight. Hence reuse DropDownHeight when HasGallery
                // value changes.
                RibbonHelper.SetDropDownHeight(menuButton._itemsPresenter, (bool)e.NewValue, menuButton.DropDownHeight);
            }

            // Note that when the HasGallery property changes we expect that the
            // VerticalScrollBarVisibilityProperty for the primary _submenuScrollViewer
            // that hosts galleries and/or menu items is updated. Even though this
            // property is marked AffectsMeasure it doesn't exactly cause the additonal
            // call to ScrollViewer.MeasureOverrider because HasGallery is typically
            // updated during a Measure pass when PrepareContainerForItemOverride is
            // called and thus the invalidation noops. To ensure that we call
            // ScrollViewer.MeasureOverride another time after this property has been
            // updated, we need to wait for the current Measure pass to subside and
            // then InvalidateMeasure on the _submenuScrollViewer.

            RibbonHelper.InvalidateScrollBarVisibility(menuButton._submenuScrollViewer);
        }