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

22. WPF Binding > Creating Bindings

Creating Bindings

image

You’ve already written one kind of binding expression when you used the TemplateBinding element in a control template, but the general binding syntax is a little different, so let’s start with a simple little example. (We’ll be expanding it as we go along.)

image

{Binding ElementName="<name>", Path="<property>"}


Put on Your Thinking Hat

image

Ready to get started? Here’s a class diagram of the Binding object. Using it and the example from a couple of pages ago, can you do the following?

image

1 Create a new project and build the basic form. Mine uses a Grid as the root element, with three columns and five rows, but you don’t need to organize it that way if you have a better idea. Make sure you give the TextBox and the labels in the last column the names specified in the second column.


  

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