wpf binding ancestor codebehind

C#
      Binding b = new Binding();

      b.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor,this.GetType(),1);

      b.Path = new PropertyPath("MyDP");

      MyLable.SetBinding(ContentProperty, b);

Source

Also in C#: