public PropertyGridDefaultContextMenu(PropertyGridTableElement propertyGridElement)
        {
            this.propertyGridElement = propertyGridElement;

            this.resetMenuItem = new PropertyGridMenuItem("Reset",
                                                          PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuReset));
            this.Items.Add(resetMenuItem);

            this.editMenuItem = new PropertyGridMenuItem("Edit",
                                                         PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuEdit));
            this.Items.Add(editMenuItem);

            this.expandCollapseMenuItem = new PropertyGridMenuItem("Expand",
                                                                   PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuExpand));
            this.Items.Add(expandCollapseMenuItem);


            this.Items.Add(new RadMenuSeparatorItem());

            RadMenuItem sortItem = new RadMenuItem(PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuSort));

            this.Items.Add(sortItem);

            noSortMenuItem        = new PropertyGridMenuItem("NoSort", PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuNoSort));
            noSortMenuItem.Click += menuItem_Click;
            sortItem.Items.Add(noSortMenuItem);

            alphabeticalMenuItem        = new PropertyGridMenuItem("Alphabetical", PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuAlphabetical));
            alphabeticalMenuItem.Click += menuItem_Click;
            sortItem.Items.Add(alphabeticalMenuItem);

            categorizedMenuItem        = new PropertyGridMenuItem("Categorized", PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuCategorized));
            categorizedMenuItem.Click += menuItem_Click;
            sortItem.Items.Add(categorizedMenuItem);

            categorizedAlphabeticalMenuItem        = new PropertyGridMenuItem("CategorizedAlphabetical", PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuCategorizedAlphabetical));
            categorizedAlphabeticalMenuItem.Click += menuItem_Click;
            sortItem.Items.Add(categorizedAlphabeticalMenuItem);

            this.Items.Add(new RadMenuSeparatorItem());

            this.showDescriptionMenuItem = new PropertyGridMenuItem("ShowDescription",
                                                                    PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuShowDescription));
            this.Items.Add(showDescriptionMenuItem);

            this.showToolbarMenuItem = new PropertyGridMenuItem("ShowToolbar",
                                                                PropertyGridLocalizationProvider.CurrentProvider.GetLocalizedString(PropertyGridStringId.ContextMenuShowToolbar));
            this.Items.Add(showToolbarMenuItem);

            for (int i = 0; i < this.Items.Count; i++)
            {
                this.Items[i].Click += menuItem_Click;
            }
        }
        private void menuItem_Click(object sender, EventArgs e)
        {
            PropertyGridMenuItem menuItem = sender as PropertyGridMenuItem;

            if (menuItem == null)
            {
                return;
            }

            switch (menuItem.Command)
            {
            case "Reset":
                Reset();
                break;

            case "Edit":
                EditNode();
                break;

            case "Expand":
            case "Collapse":
                ExpandNode();
                break;

            case "ShowToolbar":
                ShowToolbar();
                break;

            case "ShowDescription":
                ShowDescription();
                break;

            case "NoSort":
                propertyGridElement.PropertySort = System.Windows.Forms.PropertySort.NoSort;
                break;

            case "Alphabetical":
                propertyGridElement.PropertySort = System.Windows.Forms.PropertySort.Alphabetical;
                break;

            case "Categorized":
                propertyGridElement.PropertySort = System.Windows.Forms.PropertySort.Categorized;
                break;

            case "CategorizedAlphabetical":
                propertyGridElement.PropertySort = System.Windows.Forms.PropertySort.CategorizedAlphabetical;
                break;
            }
        }
Exemplo n.º 3
0
        private void menuItem_Click(object sender, EventArgs e)
        {
            PropertyGridMenuItem propertyGridMenuItem = sender as PropertyGridMenuItem;

            if (propertyGridMenuItem == null)
            {
                return;
            }
            switch (propertyGridMenuItem.Command)
            {
            case "Reset":
                this.Reset();
                break;

            case "Edit":
                this.EditItem();
                break;

            case "Expand":
            case "Collapse":
                this.ExpandItem();
                break;

            case "ShowToolbar":
                this.ShowToolbar();
                break;

            case "ShowDescription":
                this.ShowDescription();
                break;

            case "NoSort":
                this.propertyTableElement.PropertySort = PropertySort.NoSort;
                break;

            case "Alphabetical":
                this.propertyTableElement.PropertySort = PropertySort.Alphabetical;
                break;

            case "Categorized":
                this.propertyTableElement.PropertySort = PropertySort.Categorized;
                break;

            case "CategorizedAlphabetical":
                this.propertyTableElement.PropertySort = PropertySort.CategorizedAlphabetical;
                break;
            }
        }
Exemplo n.º 4
0
 public PropertyGridDefaultContextMenu(PropertyGridTableElement propertyGridElement)
 {
     this.propertyTableElement = propertyGridElement;
     this.resetMenuItem        = new PropertyGridMenuItem("Reset", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuReset"));
     this.Items.Add((RadItem)this.resetMenuItem);
     this.editMenuItem = new PropertyGridMenuItem("Edit", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuEdit"));
     this.Items.Add((RadItem)this.editMenuItem);
     this.expandCollapseMenuItem = new PropertyGridMenuItem("Expand", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuExpand"));
     this.Items.Add((RadItem)this.expandCollapseMenuItem);
     this.firstSeparator = new RadMenuSeparatorItem();
     this.Items.Add((RadItem)this.firstSeparator);
     this.sortMenuItem = new PropertyGridMenuItem("Sort", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuSort"));
     this.Items.Add((RadItem)this.sortMenuItem);
     this.noSortMenuItem        = new PropertyGridMenuItem("NoSort", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuNoSort"));
     this.noSortMenuItem.Click += new EventHandler(this.menuItem_Click);
     this.sortMenuItem.Items.Add((RadItem)this.noSortMenuItem);
     this.alphabeticalMenuItem        = new PropertyGridMenuItem("Alphabetical", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuAlphabetical"));
     this.alphabeticalMenuItem.Click += new EventHandler(this.menuItem_Click);
     this.sortMenuItem.Items.Add((RadItem)this.alphabeticalMenuItem);
     this.categorizedMenuItem        = new PropertyGridMenuItem("Categorized", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuCategorized"));
     this.categorizedMenuItem.Click += new EventHandler(this.menuItem_Click);
     this.sortMenuItem.Items.Add((RadItem)this.categorizedMenuItem);
     this.categorizedAlphabeticalMenuItem        = new PropertyGridMenuItem("CategorizedAlphabetical", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuCategorizedAlphabetical"));
     this.categorizedAlphabeticalMenuItem.Click += new EventHandler(this.menuItem_Click);
     this.sortMenuItem.Items.Add((RadItem)this.categorizedAlphabeticalMenuItem);
     this.Items.Add((RadItem) new RadMenuSeparatorItem());
     this.showDescriptionMenuItem = new PropertyGridMenuItem("ShowDescription", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuShowDescription"));
     this.Items.Add((RadItem)this.showDescriptionMenuItem);
     this.showToolbarMenuItem = new PropertyGridMenuItem("ShowToolbar", LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuShowToolbar"));
     this.Items.Add((RadItem)this.showToolbarMenuItem);
     for (int index = 0; index < this.Items.Count; ++index)
     {
         this.Items[index].Click += new EventHandler(this.menuItem_Click);
     }
     LocalizationProvider <PropertyGridLocalizationProvider> .CurrentProviderChanged += new EventHandler(this.PropertyGridLocalizationProvider_CurrentProviderChanged);
 }