You are previewing Fluent C#.

Fluent C#

Cover of Fluent C# by Rebecca M. Riordan Published by Sams

22. WPF Binding

In the last chapter we used the TemplateBinding markup extension to set values in a control template to the values of the public properties of the object. In general, “binding” simply means that the value of a property is retrieved from someplace else, and when you’re working in WPF, the dependency property system does most of the work for you. You tell WPF what you want it to do, either in XAML or code, and it handles the how.

Template bindings are a particular case of binding. WPF provides a general mechanism through the Binding object and the {Binding} markup extension. You can bind the value of a dependency property to any .NET object, and you can manipulate the binding in pretty much any way you need to.

In this chapter we’ll ...

The best content for your career. Discover unlimited learning on demand for around $1/day.