[Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Gets or sets the binding source by specifying its location relative to the position of the binding target.
Namespace:
System.Windows.Data
Assembly:
System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public Property RelativeSource As RelativeSource
Get
Set
Dim instance As Binding
Dim value As RelativeSource
value = instance.RelativeSource
instance.RelativeSource = value
public RelativeSource RelativeSource { get; set; }
<Binding RelativeSource="{RelativeSource TemplatedParent}"/>
-or-
<Binding RelativeSource="{RelativeSource Self}"/>
XAML Values
- {RelativeSource TemplatedParent}
The control where a ControlTemplate is applied is the source for this binding. This is useful for applying validation error information in bindings at the template level.
- {RelativeSource Self}
The target element should be used as the source for this binding. This is useful for binding one property of an element to another property on the same element.
Source, RelativeSource, and ElementName are mutually exclusive in a binding. If you have set one of these attributes, then setting either of the other two in a binding (through XAML or through code) will cause an exception.
Setting RelativeSource in XAML always requires the use of the RelativeSource Markup Extension. This is also true if you are creating the entire binding as a Binding Markup Extension, in which case the RelativeSource Markup Extension is nested within the RelativeSource component of the expression.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference
Other Resources