Skip to content

ControlTemplatePartNames

JaykeBird edited this page Mar 16, 2025 · 1 revision

Note: this document is only needed if you're creating your own control templates for Solid Shine UI controls. All Solid Shine UI controls come with a control template or built-in appearance out of the box with various properties/options to change, so if you're not creating a new control template, then none of the information provided here is necessary.

One of the core concepts in WPF is the idea of "lookless controls" - the logic and behavior is stored separately from a control's actual appearance. This means that other developers could swap out the appearance of a control to make it look different, but the logic would remain the same and it could still do all of the same things.

To get more specific, the appearance part is called a control template. And although the appearance is separate from the logic, the logic part might still need to rely upon certain elements being present in the template in order to actually function. It would be hard for a checkbox control to provide any functionality if the template didn't have an actual checkmark or some other way to show that it is "checked". To allow the logic to interact with elements in a control template, the logic can call upon these elements by name and then access/use them from there.

Which means that if you want to develop your own control template for a control (to set your own appearance for it), you'll want to make sure your control has the actual named elements that the control's logic will be looking for. Unfortunately, there isn't a guaranteed way to see what names or items are actually needed unless you read through all the logic code yourself - unless the developer provides a reference page that lists the names that are needed.

For the controls available out of the box in WPF, there is this section that goes through all the names needed for each template (as well as an example template for each control). For the lookless controls in Solid Shine UI, we have this page here that you're currently reading.

Many Solid Shine UI controls are built in this lookless fashion, where the appearance is set via a control template - which means you can also create your own template to set how any and each off these controls look. To build your own control template for any of the given controls, make sure you include the listed elements and give them the expected names.

So let's dive into it:

SolidShineUi / SolidShineUi.PropertyList controls

FlatButton / MenuButton / CheckBox / FlatWindow

  • None

These controls use a control template, but no named items are referred to by the logic. So if you're making your own control template for these, you don't need to worry about using specific names for any part of them.

SplitButton

As a reminder, these elements need to be present in your control template for SplitButton, or else it will not function properly. These names are case sensitive.

Name Type Function
PART_Main FlatButton The main button portion of the SplitButton
PART_Menu FlatButton The menu button portion of the SplitButton

SelectPanel

Starting with version 1.9.8, the SelectPanel's contents need to IClickSelectableControl, rather than SelectableUserControl.

As a reminder, these elements need to be present in your control template for SelectPanel, or else it will not function properly. These names are case sensitive.

Starting with 2.0 preview 1, the ItemsControl (PART_Ic) is not actually needed.

Name Type Function
PART_Ic ItemsControl The element which the SelectPanel's children are rendered within
PART_Sv ScrollViewer The scroll viewer that contains the ItemsControl - used for the AllowParentScrolling property

TabControl

The TabDisplayItem is the control that is used to render the actual "tabs" in Solid Shine UI's tab control; the TabDisplayItem control does not have a control template. You can supply your own control to use for rendering tabs in your own control template for the TabControl, with the below limitation in mind:

In versions prior to 2.0, you'd need to build your own user control in WPF that inherited from TabDisplayItem in order to be usable by the TabControl. Starting with version 2.0, you can provide any control as long as it inherits the ITabDisplayItem interface.

For the TabControl itself, here's what's needed for its control template. As a reminder, these elements need to be present in your control template for TabControl, or else it will not function properly. These names are case sensitive.

Name Type Function
PART_TabBar ItemsControl The element that contains the TabDisplayItem children (the child tabs, in the tab bar)
PART_TabScroll ScrollViewer The scroll viewer that contains the tab bar
PART_Content Border The control which contains the current tab's content (specifically, this is the border around the ContentPresenter)

PropertyList

The ExperimentalPropertyList control in the 1.9.x versions did not use a control template, and thus could not be customized in this way. This control template started to be used with version 2.0.

Name Type Function
PART_PropList StackPanel The element that the property names and editors are loaded into
PART_TypeLabel TextBlock The label that is used to display the observed object's type

IntegerSpinner / DoubleSpinner / LongSpinner / StringSpinner

The various spinner controls did not use control templates prior to version 2.0. All of them have identical control templates, so this element is common to each of these.

As a reminder, this element need to be present in your control template for the related spinner control, or else it will not function properly. These names are case sensitive.

Name Type Function
PART_Text TextBox The text box that values are displayed in, and typed into

SolidShineUi.Ribbon controls

The Ribbon and related controls were added in version 2.0, so these control templates are only available in version 2.0 and later.

Ribbon

The RibbonTabDisplayItem is the control that is used to render the actual "tabs" in Solid Shine UI's Ribbon control; the RibbonTabDisplayItem control does not have a control template. You can supply your own control to use for rendering tabs in your own control template for the Ribbon, but your control will need to inherit from RibbonTabDisplayItem.

As a reminder, these elements need to be present in your control template for Ribbon, or else it will not function properly. These names are case sensitive.

Name Type Function
PART_TabBar ItemsControl The element that contains the tab list at the top of the Ribbon
PART_TabScroll ScrollViewer The scroll viewer that contains the tab list ItemsControl
PART_Content Border The control which contains the area where the current tab's groups are rendered
PART_MainContent ItemsControl The element that renders the groups of the currently selected Ribbon tab
PART_MainScroll ScrollViewer The scroll viewer that contains the groups ItemsControl

RibbonGroup / RibbonButton / RibbonMenuButton / RibbonContentControl / RibbonCheckBox / Gallery / GalleryItem

  • None

These controls use a control template, but no named items are referred to by the logic. So if you're making your own control template for these, you don't need to worry about using specific names for any part of them.

RibbonSplitButton

As a reminder, these elements need to be present in your control template for RibbonSplitButton, or else it will not function properly. These names are case sensitive.

Name Type Function
PART_Main FlatButton The main button portion of the RibbonSplitButton
PART_Menu FlatButton The menu button portion of the RibbonSplitButton

RibbonFileMenu

As a reminder, these elements need to be present in your control template for RibbonFileMenu, or else it will not function properly. These names are case sensitive.

Name Type Function
PART_Popup Popup The base popup object that contains the opened menu
btn_Border Border The "File" button
Clone this wiki locally