Binding UI Elements with the Binding Markup Extension
You perform data-binding between a user control and a data source via the Binding
XAML markup extension. Such an extension requires specifying two properties: ElementName
, which is the source item name, and Path
, which is the property containing the actual data to bind and whose name must be exposed by the object assigned to ElementName
. The following example, in which you have to substitute to the first TextBox
in the earlier example, shows how to bind the context of a TextBox
to the value of a Slider
control so that when the user moves the selector, the slider value is reflected into the TextBox
:
<TextBox Text="{Binding ElementName=ValueSlider, Path=Value}" ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.