This method creates a new instance of a BindingExpressionBase and associates the instance with the given dependency property of the given object. This method is the way to attach a binding to an arbitrary DependencyObject that may not expose its own SetBinding method.
The following example shows how to use this method to set a binding. In this example, myNewBindDef is a Binding object that describes the binding. The binding target is myDateText, an instance of the TextBlock class.
' myDatetext is a TextBlock object that is the binding target object
BindingOperations.SetBinding(myDateText, TextBlock.TextProperty, myNewBindDef)
BindingOperations.SetBinding(myDateText, TextBlock.ForegroundProperty, myNewBindDef)
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)