コード例 #1
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            RadMenuItemBase elementAtPoint = this.ElementTree.GetElementAtPoint(e.Location) as RadMenuItemBase;
            RadMenuItemBase selectedItem   = this.GetSelectedItem() as RadMenuItemBase;

            if (elementAtPoint == null || !elementAtPoint.Enabled)
            {
                base.OnMouseMove(e);
            }
            else
            {
                if (selectedItem != null && !object.ReferenceEquals((object)selectedItem, (object)elementAtPoint))
                {
                    selectedItem.Deselect();
                    lock (this.syncObj)
                        this.itemsToClose.Push(selectedItem);
                }
                if (object.ReferenceEquals((object)elementAtPoint, this.childDropDownTimeout.Tag))
                {
                    this.childDropDownTimeout.Stop();
                    this.childDropDownTimeout.Tag = (object)null;
                }
                else if (!object.ReferenceEquals((object)selectedItem, (object)elementAtPoint))
                {
                    if (this.childDropDownTimeout.Tag == null)
                    {
                        this.childDropDownTimeout.Tag = (object)selectedItem;
                    }
                    this.childDropDownTimeout.Start();
                }
                base.OnMouseMove(e);
            }
        }
コード例 #2
0
        private void ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
        {
            if (operation == ItemsChangeOperation.Inserted ||
                operation == ItemsChangeOperation.Set)
            {
                target.AngleTransform = GetRotationDegree(this.Orientation);
            }

            RadMenuItemBase menuItem = target as RadMenuItemBase;

            if (menuItem != null)
            {
                if (operation == ItemsChangeOperation.Inserted || operation == ItemsChangeOperation.Set)
                {
                    menuItem.Owner = this;
                    if (!this.IsDesignMode)
                    {
                        menuItem.ClickMode = ClickMode.Press;
                    }
                    menuItem.IsMainMenuItem = true;
                }
                else if (operation == ItemsChangeOperation.Removed)
                {
                    menuItem.Deselect();
                    menuItem.Owner = null;
                    if (menuItem.IsPopupShown)
                    {
                        menuItem.HideChildItems();
                    }
                }
            }
        }
コード例 #3
0
        protected override void OnDropDownClosed(RadPopupClosedEventArgs args)
        {
            base.OnDropDownClosed(args);

            RadMenuItemBase currentItem = this.GetSelectedItem() as RadMenuItemBase;

            if (currentItem != null)
            {
                currentItem.Deselect();
            }

            if (!(this.OwnerElement is RadMenuItemBase))
            {
                return;
            }

            RadMenuItemBase ownerMenuItem = this.OwnerElement as RadMenuItemBase;

            if (!(this.lastPressedKey == Keys.Escape) &&
                !ownerMenuItem.IsOnDropDown &&
                ownerMenuItem.ElementTree.Control is IItemsControl)
            {
                IItemsControl   ownerItemsControl = ownerMenuItem.ElementTree.Control as IItemsControl;
                RadMenuItemBase menuItemBase      = ownerItemsControl.GetSelectedItem() as RadMenuItemBase;

                if (!object.ReferenceEquals(menuItemBase, ownerMenuItem))
                {
                    return;
                }

                ownerMenuItem.Selected = false;
            }
        }
コード例 #4
0
        protected override void SetVisibleCore(bool value)
        {
            base.SetVisibleCore(value);

            if (value == true)
            {
                if (this.ownerElement != null && this.ownerElement.ElementTree != null)
                {
                    Control ownerControl = this.ownerElement.ElementTree.Control;

                    if (ownerControl != null)
                    {
                        ownerControl.Capture = false;
                    }
                }

                if (this.popupElement is RadDropDownMenuElement)
                {
                    this.popupElement.SetValue(RadDropDownMenuElement.DropDownPositionProperty, DropDownPosition.Popup);
                }
            }
            else
            {
                RadMenuItemBase currentItem = this.GetSelectedItem() as RadMenuItemBase;
                if (currentItem != null)
                {
                    currentItem.Deselect();
                }
            }
        }
コード例 #5
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            RadMenuItemBase menuItem            = this.elementTree.GetElementAtPoint(e.Location) as RadMenuItemBase;
            RadMenuItemBase currentSelectedItem = this.GetSelectedItem() as RadMenuItemBase;

            if (!this.CanProcessItem(menuItem))
            {
                base.OnMouseMove(e);
                return;
            }

            if (currentSelectedItem != null &&
                !object.ReferenceEquals(currentSelectedItem, menuItem))
            {
                currentSelectedItem.Deselect();
                currentSelectedItem.HideChildItems();
            }

            this.childDropDownTimeout.Start();

            base.OnMouseMove(e);
        }
コード例 #6
0
        private void ItemsChanged(
            RadItemCollection changed,
            RadItem target,
            ItemsChangeOperation operation)
        {
            if (operation == ItemsChangeOperation.Inserted || operation == ItemsChangeOperation.Set)
            {
                int num = (int)target.SetDefaultValueOverride(RadElement.AngleTransformProperty, (object)this.GetRotationDegree(this.Orientation));
            }
            RadMenuItemBase radMenuItemBase = target as RadMenuItemBase;

            if (radMenuItemBase == null)
            {
                return;
            }
            switch (operation)
            {
            case ItemsChangeOperation.Inserted:
            case ItemsChangeOperation.Set:
                radMenuItemBase.Owner = (object)this;
                if (!this.IsDesignMode)
                {
                    radMenuItemBase.ClickMode = ClickMode.Press;
                }
                radMenuItemBase.IsMainMenuItem = true;
                break;

            case ItemsChangeOperation.Removed:
                radMenuItemBase.Deselect();
                radMenuItemBase.Owner = (object)null;
                if (!radMenuItemBase.IsPopupShown)
                {
                    break;
                }
                radMenuItemBase.HideChildItems();
                break;
            }
        }