当前位置: 首页>>代码示例>>C#>>正文


C# Button.SetValueToExtension方法代码示例

本文整理汇总了C#中System.Windows.Controls.Button.SetValueToExtension方法的典型用法代码示例。如果您正苦于以下问题:C# Button.SetValueToExtension方法的具体用法?C# Button.SetValueToExtension怎么用?C# Button.SetValueToExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.Button的用法示例。


在下文中一共展示了Button.SetValueToExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetToolbarItems

		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;
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:37,代码来源:DefaultSearchResult.cs

示例2: GetDefaultToolbarItems

		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;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:62,代码来源:DefaultSearchResult.cs


注:本文中的System.Windows.Controls.Button.SetValueToExtension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。