O'Reilly logo

Mastering Windows 8 C++ App Development by Pavel Yosifovich

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

Element-to-element binding

The first binding scenario we'll examine is the way in which we can connect elements together without writing any code—by performing data binding between required properties. Consider the following two elements:

<TextBlock Text="This is a sizing text"                   
    TextAlignment="Center" VerticalAlignment="Center"/>
<Slider x:Name="_slider" Grid.Row="1" Minimum="10" Maximum="100"
    Value="30"/>

Suppose we wanted the FontSize of the TextBlock to be changed, based on the current Value of the Slider. How would we go about doing that?

The obvious approach would be to use events. We can react to the ValueChanged event of the Slider and modify the FontSize property value of the TextBlock to be equal to the Value of the Slider.

This certainly ...

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