Skip to Main Content
Windows Presentation Foundation 4.5 Cookbook
book

Windows Presentation Foundation 4.5 Cookbook

by Pavel Yosifovich
September 2012
Intermediate to advanced content levelIntermediate to advanced
464 pages
10h 55m
English
Packt Publishing
Content preview from Windows Presentation Foundation 4.5 Cookbook

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.

Getting ready

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.

  1. Create a new WPF application named CH06.ElementToElementBindings.
  2. Open MainWindow.xaml. Add the following markup to the existing Grid:
    <Grid.RowDefinitions> <RowDefinition /> <RowDefinition Height="Auto" /> <RowDefinition ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Windows Presentation Foundation Development Cookbook

Windows Presentation Foundation Development Cookbook

Kunal Chowdhury

Publisher Resources

ISBN: 9781849686228Supplemental Content