Control Templates allow changing the look of the control by providing a template which will be used by the control, it is the visual structure and behavioral aspects of a Control that can be shared across multiple instances of the control. It will generally only contain TemplateBinding expressions, binding back to the properties on the control itself, while a DataTemplate will contain standard Binding expressions, binding to the properties of its DataContext.
The following are the Methods which used with ControlTemplate:
| Method Name | Description |
| Finalize | Check for calling thread has access to this DispatcherObject or Not. |
| FindName | Find element by name which defined within the template. |
| GetHashCode | Serves as a hash function for a particular type. |
| ShouldSerializeVisualTree | Check serialization processes should serialize the value of the VisualTree property and return value. |
| ToString | Returns a string that represents the current object. |
| UnregisterName | Used to removes the mapping from the XAML namescope. |
| ValidateTemplatedParent | Checks the templated parent against a set of rules. |
| GetType | Fetch or get the current instance. |
| CheckAccess | Check the calling thread is access to this DispatcherObject or not. |
| Equals(Object) | Check the object is equal to the current Object or not. |
| VerifyAccess | Used to enforces the calling thread to access the DispatcherObject. |
| RegisterName | Registers a new name/object pair. |
| ShouldSerializeResources | Check serialization processes should serialize the value of the Resources property and return value. |
| Seal | Locks the template so it cannot be changed. |
| MemberwiseClone | Creates a shallow copy. |
| LoadContent | Loads the content of the template as an instance of an object and returns the root element of the content. |
Join the conversation! Your thoughts help the community grow.