Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

21. Templates > Template Bindings

Template Bindings

In the last exercise, changing the BorderBrush or BorderThickness properties of the Button has no effect on the display. In fact, none of the appearance properties except Width and Height have any effect. That’s pretty rude, don’t you think? Controls expose an entire set of properties that can be set to control their appearance, and a well-behaved control template will respect those property settings, or at least any that apply to the new visual tree. XAML exposes a markup extension for doing just that, and it’s easy to use:

image

Put on Your Thinking Hat

image

The templates we’ve been working with set the BorderThickness and BorderBrush explicitly. Change them to use a template binding, and then set the public properties of the Button to see the changes reflected in the appearance.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial