Styling the parts of a Silverlight control template
To make a Microsoft Silverlight control look the way that you want it to, you can style it by modifying the template of the control. The behavior of the control is defined in code that you don't see. When the code needs to manipulate objects in the template, the code refers to those objects by name and type. Some objects in the template are mandatory, such as the Popup object that displays the list of items in a ComboBox control. Other objects are optional, such as the small increase and decrease RepeatButton objects that move the Thumb in a ScrollBar control. The objects in the template that are referenced by the code are called parts. You can view the parts in the Parts panel when you are editing a control template in a Silverlight application.
Microsoft Expression Blend makes it easy to design control templates by providing a list of parts in the Parts panel when you are editing a template. If a part is assigned to an object in the template, an icon appears next to the part name in the Parts panel. You can double-click the part name to automatically select the object to which it is assigned. In the Objects and Timeline panel, the same icon appears next to the object that is assigned to the part.
Other objects can exist in the template to dress up the appearance of the control, but each part plays a role in the appearance and behavior of the control to which the template is applied.
If a part is not assigned to an object in the template, an icon appears next to the part in the Parts panel. You can assign that part to an object in the template, which will convert the object into the correct type if the object isn't already of the correct type. Alternatively, you can double-click the part in the Parts panel to create the correctly named and typed object in the template.
If a part is assigned to an object of the wrong type, an icon appears next to the part in the Parts panel, and a warning icon appears next to the object in the Objects and Timeline panel. You can clear the part assignment and then convert the object to the correct type of the part, assign the part to a different object, or create a new object by double-clicking the part name in the Parts panel.
For more information, see Assign template parts to objects.
For detailed information about converting objects into controls and working with the parts of common templates, see Styling tips for common Silverlight controls.