控制項的樣式和範本Control Styles and Templates

在 Windows Presentation Foundation (WPF) 控制項有ControlTemplate包含該控制項的視覺化樹狀結構。Controls in Windows Presentation Foundation (WPF) have a ControlTemplate that contains the visual tree of that control. 您可以變更的結構和外觀的控制項,藉由修改ControlTemplate該控制項。You can change the structure and appearance of a control by modifying the ControlTemplate of that control. 沒有任何方法來取代一部分控制項之視覺化樹狀結構若要變更,您必須設定的控制項的視覺化樹狀結構Template至其新且完整的控制項屬性ControlTemplateThere is no way to replace only part of the visual tree of a control; to change the visual tree of a control you must set the Template property of the control to its new and complete ControlTemplate.

桌面佈景主題決定所使用的資源字典。The desktop themes determine which resource dictionary is used. 若要取得桌面佈景主題的資源字典,請參閱預設 WPF 佈景主題To get the resource dictionaries for the desktop themes, see Default WPF Themes.

下表說明資源字典檔案名稱及其對應的桌面佈景主題。The following table describes the resource dictionary file names and their corresponding desktop themes.

佈景主題檔案Theme file 桌面佈景主題Desktop theme
Classic.xamlClassic.xaml Windows XP 作業系統上的傳統 Windows 外觀 (源自 Windows 95、Windows 98 和 Windows 2000)。Classic Windows look (from Windows 95, Windows 98, and Windows 2000) on the Windows XP operating system..
Luna.NormalColor.xamlLuna.NormalColor.xaml Windows XP 上的預設藍色佈景主題。Default blue theme on Windows XP.
Luna.Homestead.xamlLuna.Homestead.xaml Windows XP 上的橄欖色佈景主題。Olive theme on Windows XP.
Luna.Metallic.xamlLuna.Metallic.xaml Windows XP 上的銀色佈景主題。Silver theme on Windows XP.
Royale.NormalColor.xamlRoyale.NormalColor.xaml Windows XP Media Center Edition 作業系統上的預設佈景主題。Default theme on the Windows XP Media Center Edition operating system.
Aero.NormalColor.xamlAero.NormalColor.xaml Windows Vista 作業系統上的預設佈景主題。Default theme on the Windows Vista operating system.

本節內容In This Section

Button 樣式和範本Button Styles and Templates
Calendar 樣式和範本Calendar Styles and Templates
CheckBox 樣式和範本CheckBox Styles and Templates
ComboBox 樣式和範本ComboBox Styles and Templates
ContextMenu 樣式和範本ContextMenu Styles and Templates
DataGrid 樣式和範本DataGrid Styles and Templates
DatePicker 樣式和範本DatePicker Styles and Templates
DocumentViewer 樣式和範本DocumentViewer Styles and Templates
Expander 樣式和範本Expander Styles and Templates
Frame 樣式和範本Frame Styles and Templates
GroupBox 樣式和範本GroupBox Styles and Templates
Label 樣式和範本Label Styles and Templates
ListBox 樣式和範本ListBox Styles and Templates
ListView 樣式和範本ListView Styles and Templates
Menu 樣式和範本Menu Styles and Templates
NavigationWindow 樣式和範本NavigationWindow Styles and Templates
PasswordBox 樣式和範本PasswordBox Styles and Templates
ProgressBar 樣式和範本ProgressBar Styles and Templates
RadioButton 樣式和範本RadioButton Styles and Templates
RepeatButton 樣式和範本RepeatButton Styles and Templates
ScrollBar 樣式和範本ScrollBar Styles and Templates
ScrollViewer 樣式和範本ScrollViewer Styles and Templates
Slider 樣式和範本Slider Styles and Templates
StatusBar 樣式和範本StatusBar Styles and Templates
TabControl 樣式和範本TabControl Styles and Templates
TextBox 樣式和範本TextBox Styles and Templates
Thumb 樣式和範本Thumb Styles and Templates
ToggleButton 樣式和範本ToggleButton Styles and Templates
ToolBar 樣式和範本ToolBar Styles and Templates
ToolTip 樣式和範本ToolTip Styles and Templates
TreeView 樣式和範本TreeView Styles and Templates
Window 樣式和範本Window Styles and Templates

參考資料Reference

System.Windows.Controls

ControlTemplate

控制項撰寫概觀Control Authoring Overview

樣式設定和範本化Styling and Templating