2
Reply

Why and when do we use relativesource in WPF?

    Below are the uses Of Relativesource That I Know Of In Wpf:

    – Getting An Ancestor’S Property:

    {Binding Path=Pathtoproperty,
    Relativesource={Relativesource Ancestortype={X:Type Typeofancestor}}}
    – Binding To Another Property On The Object:

    {Binding Path=Pathtoproperty, Relativesource={Relativesource Self}}
    – Bind To A Property On The Templated Parent:

    {Binding Path=Pathtoproperty, Relativesource={Relativesource Templatedparent}}
    Or
    {Templatebinding Path=Pathtoproperty}

    Original link