コード例 #1
0
        private void AddCommands()
        {
            _quickFindCommandItem = new QuickFindCommandItem(this);

            CommandItems.Add(
                new RoutedCommandItem(ApplicationCommands.Find)
            {
                Category = CommandCategories.Search,
                Text     = "Quick _find",
                ToolTip  = "Go to Quick Find box.",
            },
                _quickFindCommandItem,
                new DelegateCommandItem("FindAndReplace", new DelegateCommand(ShowFindAndReplace))
            {
                Category      = CommandCategories.Search,
                Icon          = MultiColorGlyphs.Find,
                InputGestures = new InputGestureCollection {
                    new KeyGesture(Key.F, ModifierKeys.Control | ModifierKeys.Shift)
                },
                Text    = "F_ind and replace...",
                ToolTip = "Show the Find and Replace window.",
            },
                new DelegateCommandItem("FindPrevious", new DelegateCommand(FindPrevious, CanFind))
            {
                Category      = CommandCategories.Search,
                Icon          = MultiColorGlyphs.FindPrevious,
                InputGestures = new InputGestureCollection {
                    new KeyGesture(Key.F3, ModifierKeys.Shift)
                },
                Text    = "Find previous",
                ToolTip = "Jump to previous search result."
            },
                new DelegateCommandItem("FindNext", new DelegateCommand(FindNext, CanFind))
            {
                Category      = CommandCategories.Search,
                Icon          = MultiColorGlyphs.FindNext,
                InputGestures = new InputGestureCollection {
                    new KeyGesture(Key.F3, ModifierKeys.None)
                },
                Text    = "_Find next",
                ToolTip = "Jump to next search result."
            },
                new DelegateCommandItem("Replace", new DelegateCommand(Replace, CanFind))
            {
                Category = CommandCategories.Search,
                Text     = "_Replace",
                ToolTip  = "Replace current search result."
            },
                new DelegateCommandItem("ReplaceAll", new DelegateCommand(ReplaceAll, CanFind))
            {
                Category = CommandCategories.Search,
                Text     = "Replace _all",
                ToolTip  = "Replace all search results."
            }
                );
        }
コード例 #2
0
 private void RemoveCommands()
 {
     CommandItems.Clear();
     _quickFindCommandItem = null;
 }