Fluent.InRibbonGallery.OnDropDownOpened C# (CSharp) Méthode

OnDropDownOpened() private méthode

private OnDropDownOpened ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Résultat void
        void OnDropDownOpened(object sender, EventArgs e)
        {
            IsSnapped = true;
            minimalGallerylWidth = Math.Max(galleryPanel.ActualWidth, galleryPanel.GetActualMinWidth(MinItemsInDropDownRow));
            currentItemsInRow = galleryPanel.MinItemsInRow;
            controlPresenter.Content = null;
            popupControlPresenter.Content = galleryPanel;
            galleryPanel.Width = double.NaN;
            scrollViewer.Height = double.NaN;
            if (DropDownOpened != null) DropDownOpened(this, e);
            galleryPanel.MinItemsInRow = Math.Max(currentItemsInRow, MinItemsInDropDownRow);
            galleryPanel.MaxItemsInRow = MaxItemsInDropDownRow;
            galleryPanel.IsGrouped = true;
            dropDownButton.IsChecked = true;
            canOpenDropDown = false;

            Mouse.Capture(this, CaptureMode.SubTree);

            focusedElement = Keyboard.FocusedElement;
            Debug.WriteLine("Focused element - " + focusedElement);
            if (focusedElement != null)
            {
                focusedElement.LostKeyboardFocus += OnFocusedElementLostKeyboardFocus;
                focusedElement.PreviewKeyDown += OnFocusedElementPreviewKeyDown;
            }

            //if (ResizeMode != ContextMenuResizeMode.None)
            {
                scrollViewer.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                double initialHeight = Math.Min(RibbonControl.GetControlWorkArea(this).Height, MaxDropDownHeight);
                if (!double.IsNaN(DropDownHeight)) initialHeight = Math.Min(DropDownHeight, MaxDropDownHeight);
                double menuHeight = 0;
                if (Menu != null)
                {
                    Menu.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                    menuHeight = Menu.DesiredSize.Height;
                }
                if (scrollViewer.DesiredSize.Height > initialHeight)
                {
                    scrollViewer.Height = initialHeight - menuHeight;
                    if (scrollViewer.Height < galleryPanel.GetItemSize().Height)
                        scrollViewer.Height = galleryPanel.GetItemSize().Height;
                }
                galleryPanel.Width = minimalGallerylWidth;
            }
        }