mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-06 07:56:06 +02:00
* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
40 lines
1.7 KiB
Markdown
40 lines
1.7 KiB
Markdown
---
|
|
title: "How to: Style Controls on a ToolBar"
|
|
ms.date: "03/30/2017"
|
|
helpviewer_keywords:
|
|
- "styling controls on toolbar [WPF]"
|
|
- "toolbars [WPF]"
|
|
- "customizing controls on toolbar [WPF]"
|
|
ms.assetid: ba6ae056-d6a9-4c24-90f8-467ab0bc0b1a
|
|
---
|
|
# How to: Style Controls on a ToolBar
|
|
The <xref:System.Windows.Controls.ToolBar> defines <xref:System.Windows.ResourceKey> objects to specify the style of controls within the <xref:System.Windows.Controls.ToolBar>. To style a control in a <xref:System.Windows.Controls.ToolBar>, set the `x:key` attribute of the style to a <xref:System.Windows.ResourceKey> defined in <xref:System.Windows.Controls.ToolBar>.
|
|
|
|
The <xref:System.Windows.Controls.ToolBar> defines the following <xref:System.Windows.ResourceKey> objects:
|
|
|
|
- <xref:System.Windows.Controls.ToolBar.ButtonStyleKey%2A>
|
|
|
|
- <xref:System.Windows.Controls.ToolBar.CheckBoxStyleKey%2A>
|
|
|
|
- <xref:System.Windows.Controls.ToolBar.ComboBoxStyleKey%2A>
|
|
|
|
- <xref:System.Windows.Controls.ToolBar.MenuStyleKey%2A>
|
|
|
|
- <xref:System.Windows.Controls.ToolBar.RadioButtonStyleKey%2A>
|
|
|
|
- <xref:System.Windows.Controls.ToolBar.SeparatorStyleKey%2A>
|
|
|
|
- <xref:System.Windows.Controls.ToolBar.TextBoxStyleKey%2A>
|
|
|
|
- <xref:System.Windows.Controls.ToolBar.ToggleButtonStyleKey%2A>
|
|
|
|
## Example
|
|
The following example defines styles for the controls within a <xref:System.Windows.Controls.ToolBar>.
|
|
|
|
[!code-xaml[ToolBar_snip#ToolBarAllStyles](~/samples/snippets/csharp/VS_Snippets_Wpf/ToolBar_snip/CS/pane1.xaml#toolbarallstyles)]
|
|
[!code-xaml[ToolBar_snip#ToolBar](~/samples/snippets/csharp/VS_Snippets_Wpf/ToolBar_snip/CS/pane1.xaml#toolbar)]
|
|
|
|
## See also
|
|
|
|
- [Styling and Templating](/dotnet/desktop-wpf/fundamentals/styles-templates-overview)
|