O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introducing Binding

The key to data binding is a Binding markup extension that “glues” two properties together and keeps a channel of communication open between them. You can set up a Binding once and then have it do all the synchronization work for the remainder of the app’s lifetime.

Imagine that you have a TextBlock with text that you want to automatically update as the user types in a TextBox, such as the following:

<StackPanel Orientation="Horizontal">  <!-- The user should type a username here -->  <TextBox Name="textBox"           TextChanged="TextBox_TextChanged"/>  <!-- This displays, "Hi, username!" -->  <TextBlock>    <Run>Hi, </Run>    <Run x:Name="run"/>    <Run>!</Run>  </TextBlock></StackPanel>

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required