Пример #1
0
        //创建排序的菜单项
        private void createSummarySortItem()
        {
            XtraPivotMenu sortMenu = null;

            if (_CreateOtherMenuByUser || this.ContextMenu == null)
            {
                return;
            }
            foreach (XtraPivotMenu menu in this.ContextMenu.MenuItems)
            {
                if (menu.MenuType == XtraContextMenuType.Sort)
                {
                    sortMenu = menu;
                    break;
                }
            }
            if (sortMenu == null)
            {
                return;
            }

            sortMenu.MenuItems.Clear();
            foreach (DevExpress.XtraPivotGrid.PivotGridField info in this.Fields)
            {
                if (info.Area == DevExpress.XtraPivotGrid.PivotArea.DataArea)
                {
                    sortMenu.MenuItems.Add(new XtraPivotMenu(info.Caption, new System.EventHandler(summaryFieldClick), XtraContextMenuType.Sort, info));
                }
            }
        }
Пример #2
0
        private void summaryFieldClick(object sender, System.EventArgs e)
        {
            XtraPivotMenu menu = sender as XtraPivotMenu;

            if (menu == null || _SummarySortField == null)
            {
                return;
            }
            _SummarySortField.SortOrder = _SummarySortField.SortOrder == DevExpress.XtraPivotGrid.PivotSortOrder.Ascending? DevExpress.XtraPivotGrid.PivotSortOrder.Descending:DevExpress.XtraPivotGrid.PivotSortOrder.Ascending;
            _SummarySortField.SortBySummaryInfo.Field = menu.SortField;
        }
Пример #3
0
        private void menuItemClick(object sender, System.EventArgs e)
        {
            XtraPivotMenu menu = sender as XtraPivotMenu;

            if (menu == null)
            {
                return;
            }

            PivotGridHelper.Instance.HandleClickXtraContextMenu(this.ParentForm as MB.WinBase.IFace.IForm, this, menu.MenuType);
        }
Пример #4
0
        private System.Windows.Forms.MenuItem createMenuByType(XtraContextMenuType menuType)
        {
            Type          enumType = typeof(XtraContextMenuType);
            string        str      = MB.Util.MyCustomAttributeLib.Instance.GetFieldDesc(enumType, menuType.ToString(), false);
            XtraPivotMenu menu     = null;

            if (menuType != XtraContextMenuType.Sort)
            {
                menu = new XtraPivotMenu(str, new System.EventHandler(menuItemClick), menuType);
            }
            else
            {
                menu = new XtraPivotMenu(str, XtraContextMenuType.Sort);
            }
            this.ContextMenu.MenuItems.Add(menu);
            return(menu);
        }