Subscribe to our YouTube Channel for more Videos

How to use RelativeSource with WPF Binding in XAML?

When working with the WPF application , you might sometimes want to use the relative source with the bindings in WPF (Windows Presentation foundation) .

How to use RelativeSource with WPF Binding in XAML?

You can do that by setting the RelativeSource attribute of the Binding property in XAML as shown below.

{Binding Path=PathToProperty, RelativeSource={RelativeSource Self}}

Check the MSDN article on the RelativeSourceMode property to know more about it

Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.