public IList GetToolbarItems() { WorkbenchSingleton.AssertMainThread(); if (toolbarItems == null) { toolbarItems = new List<object>(); DropDownButton perFileDropDown = new DropDownButton(); perFileDropDown.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.FindIcon") }; perFileDropDown.SetValueToExtension(DropDownButton.ToolTipProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.SelectViewMode.ToolTip")); flatItem = new MenuItem(); flatItem.SetValueToExtension(MenuItem.HeaderProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.Flat")); flatItem.Click += delegate { SetPerFile(false); }; perFileItem = new MenuItem(); perFileItem.SetValueToExtension(MenuItem.HeaderProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.PerFile")); perFileItem.Click += delegate { SetPerFile(true); }; perFileDropDown.DropDownMenu = new ContextMenu(); perFileDropDown.DropDownMenu.Items.Add(flatItem); perFileDropDown.DropDownMenu.Items.Add(perFileItem); toolbarItems.Add(perFileDropDown); toolbarItems.Add(new Separator()); Button expandAll = new Button(); expandAll.SetValueToExtension(Button.ToolTipProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.ExpandAll.ToolTip")); expandAll.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.OpenAssembly") }; expandAll.Click += delegate { ExpandCollapseAll(true); }; toolbarItems.Add(expandAll); Button collapseAll = new Button(); collapseAll.SetValueToExtension(Button.ToolTipProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.CollapseAll.ToolTip")); collapseAll.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.Assembly") }; collapseAll.Click += delegate { ExpandCollapseAll(false); }; toolbarItems.Add(collapseAll); } return toolbarItems; }
protected IList GetDefaultToolbarItems() { if (toolbarItems == null) { toolbarItems = new List<object>(); DropDownButton perFileDropDown = new DropDownButton(); perFileDropDown.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.FindIcon") }; perFileDropDown.SetValueToExtension(DropDownButton.ToolTipProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.SelectViewMode.ToolTip")); MenuItem flatItem = new MenuItem(); flatItem.IsCheckable = true; flatItem.SetValueToExtension(MenuItem.HeaderProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.Flat")); flatItem.Click += delegate { SetResultGrouping(); SetCheckedItem(flatItem, perFileDropDown.DropDownMenu); }; MenuItem perFileItem = new MenuItem(); perFileItem.IsCheckable = true; perFileItem.SetValueToExtension(MenuItem.HeaderProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.PerFile")); perFileItem.Click += delegate { SetResultGrouping(SearchResultGroupingKind.PerFile); SetCheckedItem(perFileItem, perFileDropDown.DropDownMenu); }; MenuItem perProjectItem = new MenuItem(); perProjectItem.IsCheckable = true; perProjectItem.SetValueToExtension(MenuItem.HeaderProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.PerProject")); perProjectItem.Click += delegate { SetResultGrouping(SearchResultGroupingKind.PerProject); SetCheckedItem(perProjectItem, perFileDropDown.DropDownMenu); }; MenuItem perProjectAndFileItem = new MenuItem(); perProjectAndFileItem.IsCheckable = true; perProjectAndFileItem.SetValueToExtension(MenuItem.HeaderProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.PerProjectAndFile")); perProjectAndFileItem.Click += delegate { SetResultGrouping(SearchResultGroupingKind.PerProjectAndFile); SetCheckedItem(perProjectAndFileItem, perFileDropDown.DropDownMenu); }; perFileDropDown.DropDownMenu = new ContextMenu(); perFileDropDown.DropDownMenu.Items.Add(flatItem); perFileDropDown.DropDownMenu.Items.Add(perFileItem); perFileDropDown.DropDownMenu.Items.Add(perProjectItem); perFileDropDown.DropDownMenu.Items.Add(perProjectAndFileItem); toolbarItems.Add(perFileDropDown); toolbarItems.Add(new Separator()); Button expandAll = new Button(); expandAll.SetValueToExtension(Button.ToolTipProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.ExpandAll.ToolTip")); expandAll.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.OpenCollection") }; expandAll.Click += delegate { ExpandCollapseAll(true); }; toolbarItems.Add(expandAll); Button collapseAll = new Button(); collapseAll.SetValueToExtension(Button.ToolTipProperty, new LocalizeExtension("MainWindow.Windows.SearchResultPanel.CollapseAll.ToolTip")); collapseAll.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.Collection") }; collapseAll.Click += delegate { ExpandCollapseAll(false); }; toolbarItems.Add(collapseAll); } return toolbarItems; }