Modifying existing controls
When we find that the wide range of existing controls do not quite meet our needs, we might think that we need to create some new ones, as we would with other technologies. When using other UI languages, this might be the case, but with WPF, this is not necessarily correct, as it provides a number of ways to modify the existing controls to suit our requirements.
As we found out earlier, all classes that extend the FrameworkElement
class have access to the framework's styling capabilities and those that extend the Control
class can have their appearance totally changed through their ControlTemplate
property. All of the existing WPF controls extend these base cases and so, possess these abilities.
In addition to these capabilities that enable us to change the look of the pre-existing WPF controls, we are also able to leverage the power of Attached Properties to add additional functionality to them too. In this section, we will investigate these different ways of modifying...