Files
docs-desktop/dotnet-desktop-guide/framework/wpf/data/how-to-specify-the-direction-of-the-binding.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

2.9 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
How to: Specify the Direction of the Binding 03/30/2017
direction of binding [WPF]
binding direction [WPF]
data binding [WPF], direction of binding
37334478-028b-4514-86c9-1420709f4818

How to: Specify the direction of the binding

This example shows how to specify whether the binding updates only the binding target (target) property, the binding source (source) property, or both the target property and the source property.

Example

You use the xref:System.Windows.Data.Binding.Mode%2A?displayProperty=nameWithType property to specify the direction of the binding. The following are the available options for binding updates:

For more information, see the xref:System.Windows.Data.BindingMode enumeration.

The following example shows how to set the xref:System.Windows.Data.Binding.Mode%2A property.

[!code-xamlDirectionalBinding#4]

To detect source changes (applicable to xref:System.Windows.Data.BindingMode.OneWay and xref:System.Windows.Data.BindingMode.TwoWay bindings), the source must implement a suitable property change notification mechanism such as xref:System.ComponentModel.INotifyPropertyChanged. See Implement Property Change Notification for an example of an xref:System.ComponentModel.INotifyPropertyChanged implementation.

For xref:System.Windows.Data.BindingMode.TwoWay or xref:System.Windows.Data.BindingMode.OneWayToSource bindings, you can control the timing of the source updates by setting the xref:System.Windows.Data.Binding.UpdateSourceTrigger%2A property. See xref:System.Windows.Data.Binding.UpdateSourceTrigger%2A for more information.

See also