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
  • PrintPrint
Share this Page URL
Help

15. XAML > Content Properties

Content Properties

Did you notice that in the Button property element example, we had to specify the Height property as Button.Height?

image

Repeating the object name like that makes it clear that you’re referring to a property, not some other element named Height. But every WPF element can define a single property, called the content property, that can simply be placed between the opening and closing tags of the object. For the Button, the content property is whatever’s displayed inside the Button, usually a string:

image

The tricky bit about using the content property is knowing what it means. Technically, the content property is any object that will be displayed by the ContentPresenter of the control’s template. (We’ll examine control templates in Chapter 21.) It’s usually intuitive, though, like the Button. I mean, what else would you expect the control to do with “Click Me, Please” but display it?


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint