Element to element binding
Data binding is classically done between a user interface element and a data object. Sometimes, however, it's useful to bind one element's property to another's property. This can reduce (or even eliminate) the need for handling conventional events. Let's see how to make this work. This will also serve as a good start for doing bindings of any kind.
Make sure Visual Studio is up and running.
How to do it...
We'll create a
Slider that affects the font size of a
TextBlock without using any code.
- Create a new WPF application named
MainWindow.xaml. Add the following markup to the existing
<Grid.RowDefinitions> <RowDefinition /> <RowDefinition Height="Auto" /> <RowDefinition ...