示例#1
0
        protected internal virtual void OnItemListMenuDisplaying(RadPageViewMenuDisplayingEventArgs e)
        {
            if (!this.CanRaiseEvents)
            {
                return;
            }
            EventHandler <RadPageViewMenuDisplayingEventArgs> eventHandler = this.Events[RadPageView.ItemListMenuDisplayingEventKey] as EventHandler <RadPageViewMenuDisplayingEventArgs>;

            if (eventHandler == null)
            {
                return;
            }
            eventHandler((object)this, e);
        }
示例#2
0
        protected internal virtual void OnItemListMenuDisplaying(RadPageViewMenuDisplayingEventArgs e)
        {
            if (!this.CanRaiseEvents)
            {
                return;
            }

            EventHandler <RadPageViewMenuDisplayingEventArgs> eh = this.Events[ItemListMenuDisplayingEventKey] as EventHandler <RadPageViewMenuDisplayingEventArgs>;

            if (eh != null)
            {
                eh(this, e);
            }
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected internal virtual void DisplayItemListMenu(RadPageViewMenuDisplayingEventArgs e)
        {
            if (this.owner != null)
            {
                this.owner.OnItemListMenuDisplaying(e);
            }

            if (e.Cancel)
            {
                return;
            }

            foreach (RadMenuItemBase menuItem in e.Items)
            {
                this.itemListMenu.Items.Add(menuItem);
            }

            this.itemListMenu.DropDown.HorizontalPopupAlignment = e.HAlign;
            this.itemListMenu.DropDown.VerticalPopupAlignment   = e.VAlign;

            RadControl parent = (this.ElementTree.Control as RadControl);

            if (parent != null)
            {
                this.itemListMenu.ThemeName = parent.ThemeName;
            }

            if (!this.itemListMenu.DropDown.IsLoaded)
            {
                this.itemListMenu.DropDown.LoadElementTree();
            }
            else
            {
                this.itemListMenu.DropDown.RootElement.UpdateLayout();
            }
            this.itemListMenu.DropDown.RightToLeft = (this.RightToLeft) ? System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.No;
            this.itemListMenu.DropDown.ShowPopup(e.AlignRect);

            if (this.owner != null)
            {
                this.owner.OnItemListMenuDisplayed(EventArgs.Empty);
            }
        }
示例#4
0
        /// <summary>
        /// Displays the item list menu, using the provided element as menu's owner and the specified horizontal and vertical alignment.
        /// </summary>
        /// <param name="menuOwner"></param>
        /// <param name="hAlign"></param>
        /// <param name="vAlign"></param>
        public void DisplayItemListMenu(RadPageViewElementBase menuOwner, HorizontalPopupAlignment hAlign, VerticalPopupAlignment vAlign)
        {
            if (this.ElementState != ElementState.Loaded)
            {
                return;
            }
            if (this.itemListMenu.DropDown.IsDisplayed)
            {
                this.itemListMenu.DropDown.ClosePopup(RadPopupCloseReason.CloseCalled);
            }

            List <RadMenuItemBase> menuItems = new List <RadMenuItemBase>();

            foreach (RadPageViewItem item in this.items)
            {
                if (item.Visibility == ElementVisibility.Collapsed)
                {
                    continue;
                }

                RadMenuItem menuItem = new RadMenuItem(item.Text);
                menuItem.Image  = item.Image;
                menuItem.Click += this.OnItemListMenuItem_Click;
                menuItem.Tag    = item;
                if (item == this.selectedItem)
                {
                    menuItem.IsChecked = true;
                }

                menuItems.Add(menuItem);
            }

            Rectangle alignRect = this.ElementTree.Control.RectangleToScreen(menuOwner.ControlBoundingRectangle);
            RadPageViewMenuDisplayingEventArgs e = new RadPageViewMenuDisplayingEventArgs(menuItems, alignRect, hAlign, vAlign);

            this.DisplayItemListMenu(e);
        }