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; } }
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(); } }