CONTENTS
Subclassing Existing Styles................................................................................................................ 1295
The Role of Unnamed Styles............................................................................................................... 1295
Defining Styles with Triggers ............................................................................................................. 1296
Defining Styles with Multiple Triggers................................................................................................ 1297
Animated Styles.................................................................................................................................. 1297
Assigning Styles Programmatically .................................................................................................... 1298
Summary .....................................................................................................................1300
Chapter 31: Dependency Properties, Routed Events, and Templates ..............1301
Understanding the Role of Dependency Properties .....................................................1301
Examining an Existing Dependency Property ..................................................................................... 1303
Important Notes Regarding CLR Property Wrappers .......................................................................... 1305
Building a Custom Dependency Property ....................................................................1306
Adding a Data Validation Routine ....................................................................................................... 1311
Responding to the Property Change ................................................................................................... 1312
Understanding Routed Events .....................................................................................1313
The Role of Routed Bubbling Events................................................................................................... 1314
Continuing or Halting Bubbling........................................................................................................... 1315
The Role of Routed Tunneling Events................................................................................................. 1315
Logical Trees, Visual Trees, and Default Templates....................................................1317
Programmatically Inspecting a Logical Tree ...................................................................................... 1318
Programmatically Inspecting a Visual Tree ........................................................................................ 1319
Programmatically Inspecting a Control’s Default Template ............................................................... 1321
Building a Control Template with the Trigger Framework...........................................1325
Templates As Resources .................................................................................................................... 1326
Incorporating Visual Cues Using Triggers........................................................................................... 1329
The Role of the {TemplateBinding} Markup Extension ....................................................................... 1329
The Role of ContentPresenter............................................................................................................. 1331
Incorporating Templates into Styles................................................................................................... 1332
xlvii