PART_ in Control Templates (List of WPF Template Parts)

Scroll down for list of Control Template Parts.

Related articles:
MSDN
Using Templates to Customize WPF Controls – sample inculed
n+ nerd plus art
Blueboxes – The use of PART_ in Control Templates

Simple class which I wrote to retrieve the Control Template Parts.

It is important to point out at not controls use the TemplatePartAttribute which means that you will not need to use the PART_xxx on all controls.

For example Button (also see MSDN) is not adorned with the TemplatePartAttribute so you cannot use PART_xxx in a ControlTemplate for a Button.

PrgressBar (also see MSDN, note the use of PART_Track and PART_Indicator ). is a more complex control which is adorned with the TemplatePartAttribute and so does support using PART_xxx in a ControlTemplate (see below the button snippet for ProgressBar snippet).

Button – Partially view from ILSpy
Notice that TemplatePartAttribute is not used.

using MS.Internal.Commands;
using MS.Internal.KnownBoxes;
using System;
using System.Windows.Automation.Peers;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace System.Windows.Controls
{
/// <summary>
///  Represents a Windows button control, which reacts to     the <see cref=“E:System.Windows.Controls.Primitives.ButtonBase.Click” /> event.
///           </summary>
public class Button : ButtonBase
{

——————————————————————————————-
ProgressBar – Partially view from ILSpy
Notice that TemplatePartAttribute is used.

using MS.Internal.KnownBoxes;
using System;
using System.Windows.Automation.Peers;
using System.Windows.Controls.Primitives;
namespace System.Windows.Controls
{
///
/// Indicates the progress of an operation.
///

[TemplatePart(Name = “PART_Indicator“, Type = typeof(FrameworkElement)), TemplatePart(Name = “PART_Track“, Type = typeof(FrameworkElement))]
public class ProgressBar : RangeBase
{
private const string TrackTemplateName = “PART_Track“;
private const string IndicatorTemplateName = “PART_Indicator“;
……

Reflection was used to retrieve the TemplateParts from the PresentationFramework.dll

Template Parts List (standard template parts listed, you could also have custom parts)

Type Namespace PART
ComboBox System.Windows.Controls.Primitives.Popup PART_Popup
ComboBox System.Windows.Controls.TextBox PART_EditableTextBox
DocumentViewer System.Windows.Controls.ContentControl PART_FindToolBarHost
DocumentViewer System.Windows.Controls.ScrollViewer PART_ContentHost
EditorMenuItem System.Windows.Controls.Primitives.Popup PART_Popup
EditorMenuItem System.Windows.Controls.Primitives.Popup PART_Popup
FlowDocumentPageViewer System.Windows.Controls.Decorator PART_FindToolBarHost
FlowDocumentReader System.Windows.Controls.Decorator PART_ContentHost
FlowDocumentReader System.Windows.Controls.Decorator PART_FindToolBarHost
FlowDocumentScrollViewer System.Windows.Controls.Decorator PART_FindToolBarHost
FlowDocumentScrollViewer System.Windows.Controls.Decorator PART_ToolBarHost
FlowDocumentScrollViewer System.Windows.Controls.ScrollViewer PART_ContentHost
Frame System.Windows.Controls.ContentPresenter PART_FrameCP
GridViewColumnHeader System.Windows.Controls.Canvas PART_FloatingHeaderCanvas
GridViewColumnHeader System.Windows.Controls.Primitives.Thumb PART_HeaderGripper
MenuItem System.Windows.Controls.Primitives.Popup PART_Popup
NavigationWindow System.Windows.Controls.ContentPresenter PART_NavWinCP
PasswordBox System.Windows.FrameworkElement PART_ContentHost
ProgressBar System.Windows.FrameworkElement PART_Indicator
ProgressBar System.Windows.FrameworkElement PART_Track
ReaderPageViewer System.Windows.Controls.Decorator PART_FindToolBarHost
ReaderScrollViewer System.Windows.Controls.Decorator PART_FindToolBarHost
ReaderScrollViewer System.Windows.Controls.Decorator PART_ToolBarHost
ReaderScrollViewer System.Windows.Controls.ScrollViewer PART_ContentHost
ReaderTwoPageViewer System.Windows.Controls.Decorator PART_FindToolBarHost
ReconversionMenuItem System.Windows.Controls.Primitives.Popup PART_Popup
RichTextBox System.Windows.FrameworkElement PART_ContentHost
RootBrowserWindow System.Windows.Controls.ContentPresenter PART_NavWinCP
ScrollBar System.Windows.Controls.Primitives.Track PART_Track
ScrollViewer System.Windows.Controls.Primitives.ScrollBar PART_HorizontalScrollBar
ScrollViewer System.Windows.Controls.Primitives.ScrollBar PART_VerticalScrollBar
ScrollViewer System.Windows.Controls.ScrollContentPresenter PART_ScrollContentPresenter
Slider System.Windows.Controls.Primitives.Track PART_Track
Slider System.Windows.FrameworkElement PART_SelectionRange
StickyNoteControl System.Windows.Controls.Button PART_CloseButton
StickyNoteControl System.Windows.Controls.Button PART_IconButton
StickyNoteControl System.Windows.Controls.ContentControl PART_ContentControl
StickyNoteControl System.Windows.Controls.MenuItem PART_CopyMenuItem
StickyNoteControl System.Windows.Controls.MenuItem PART_EraseMenuItem
StickyNoteControl System.Windows.Controls.MenuItem PART_InkMenuItem
StickyNoteControl System.Windows.Controls.MenuItem PART_PasteMenuItem
StickyNoteControl System.Windows.Controls.MenuItem PART_SelectMenuItem
StickyNoteControl System.Windows.Controls.Primitives.Thumb PART_ResizeBottomRightThumb
StickyNoteControl System.Windows.Controls.Primitives.Thumb PART_TitleThumb
TabControl System.Windows.Controls.ContentPresenter PART_SelectedContentHost
TextBox System.Windows.FrameworkElement PART_ContentHost
TextBoxBase System.Windows.FrameworkElement PART_ContentHost
ToolBar System.Windows.Controls.Primitives.ToolBarOverflowPanel PART_ToolBarOverflowPanel
ToolBar System.Windows.Controls.Primitives.ToolBarPanel PART_ToolBarPanel
TreeViewItem System.Windows.FrameworkElement PART_Header