Each FrameworkElement has a DataContext , which is an arbitrary object. By default, the data binding source is a DataContext . You can use RelativeSource.Self to change the binding source to the FrameworkElement itself, and not its DataContext . Thus, the RelativeSource part simply moves you “one level” from the DataContext from FrameworkElement to FrameworkElement itself. When you are in FrameworkElement , you can specify the path to any of its properties. If the FrameworkElement is a Popup , it will have a PlacementTarget property, which is another FrameworkElement , which the Popup is relative to.
In short, if you have a Popup placed relative to the TextBox , for example, this expression sets the DataContext from the Popup to the TextBox and as a result {Binding Text} somewhere in the body of the Popup binds to the TextBox .
source share