Replacing the control template of a progress bar
WPF prides itself on separating appearance from behavior. This is more evident with control templates than anything else. A control template is just that: a template for a control's appearance, which does not affect its behavior. In this recipe, we'll take a look at the basics of writing a control template by creating a custom template for a ProgressBar
control. In later recipes we'll discuss other, more complex control templates.
Getting ready
Make sure Visual Studio is up and running.
How to do it...
We'll create an alternative control template for a ProgressBar
to demonstrate the basics of control template authoring:
- Create a new WPF application named
CH08.CustomProgressBar
. - Open
App.xaml
. Add a new ...
Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.