Пример #1
0
        protected virtual void OnPopupOpenend(object sender, EventArgs e)
        {
            RibbonApplicationMenu menu = ItemsControl.ItemsControlFromItemContainer(this) as RibbonApplicationMenu;

            if (menu != null)
            {
                Rect subMenuRect = menu.GetSubMenuRect(this);
                popup.Placement        = PlacementMode.Relative;
                popup.VerticalOffset   = subMenuRect.Top;
                popup.HorizontalOffset = subMenuRect.Left;
                popup.Width            = subMenuRect.Width;
                popup.Height           = subMenuRect.Height;
            }
        }
Пример #2
0
        static void OpenPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            RibbonApplicationMenu menu = (RibbonApplicationMenu)o;
            bool newValue = (bool)e.NewValue;

            if (menu.appButton != null)
            {
                menu.appButton.IsDropDownPressed = newValue;
            }
            if (newValue)
            {
                menu.OnMenuOpened();
            }
            else
            {
                menu.OnMenuClosed();
            }
        }