Пример #1
0
        private void RemoveCommands()
        {
            CommandItems.Clear();

            _toolBarsCommandItem.Dispose();
            _toolBarsCommandItem = null;
        }
Пример #2
0
        private void AddCommands()
        {
            _toolBarsCommandItem = new ToolBarsCommandItem(this);

            CommandItems.Add(
                new DelegateCommandItem("Exit", new DelegateCommand(() => Editor.Exit()))
            {
                Category = CommandCategories.File,
                Icon     = MultiColorGlyphs.Exit,
                Text     = "E_xit",
                ToolTip  = "Close this application."
            },
                new RoutedCommandItem(ApplicationCommands.Undo)
            {
                Category = CommandCategories.Edit,
                Icon     = MultiColorGlyphs.Undo,
                ToolTip  = "Undo the last operation.",
            },
                new RoutedCommandItem(ApplicationCommands.Redo)
            {
                Category = CommandCategories.Edit,
                Icon     = MultiColorGlyphs.Redo,
                ToolTip  = "Perform the last undone operation.",
            },
                new RoutedCommandItem(ApplicationCommands.Cut)
            {
                Category = CommandCategories.Edit,
                Icon     = MultiColorGlyphs.Cut,
                ToolTip  = "Remove selected item and copy it to the clipboard.",
            },
                new RoutedCommandItem(ApplicationCommands.Copy)
            {
                Category = CommandCategories.Edit,
                Icon     = MultiColorGlyphs.Copy,
                ToolTip  = "Copy selected item to the clipboard.",
            },
                new RoutedCommandItem(ApplicationCommands.Paste)
            {
                Category = CommandCategories.Edit,
                Icon     = MultiColorGlyphs.Paste,
                ToolTip  = "Paste the content of the clipboard into the active document.",
            },
                new RoutedCommandItem(ApplicationCommands.Delete)
            {
                Category = CommandCategories.Edit,
                Icon     = MultiColorGlyphs.Delete,
                ToolTip  = "Delete the selected item.",
            },
                new RoutedCommandItem(ApplicationCommands.SelectAll)
            {
                Category = CommandCategories.Edit,
                Text     = "Select all",
                ToolTip  = "Select all items of the current document.",
            },
                _toolBarsCommandItem,
                new DelegateCommandItem("ShowAllToolBars", _toolBarsCommandItem.ToggleAllToolBarsCommand)
            {
                Category         = CommandCategories.View,
                CommandParameter = Boxed.BooleanTrue,       // true = make visible.
                Text             = "_Show all",
                ToolTip          = "Show all toolbars."
            },
                new DelegateCommandItem("HideAllToolBars", _toolBarsCommandItem.ToggleAllToolBarsCommand)
            {
                Category         = CommandCategories.View,
                CommandParameter = Boxed.BooleanFalse,      // false = make invisible
                Text             = "_Hide all",
                ToolTip          = "Hide all toolbars."
            });
        }