Nested Binding With WPF
<p>I am newbie to WPF and curious to know how to nested bind the properties in WPF.  I have made a sample app for better understanding. Please find below the following scenario's.  </p>

<h2><strong>Working Code:</strong></h2>

<blockquote>
  <p>UserControl1 >> MainWindow</p>
</blockquote>

<p>Created a UserControl and included it in the mainWindow. </p>

<p><em>UserControl1.xaml</em></p>

<pre><code>&lt;StackPanel&gt;
     &lt;TextBox x:Name="text1" Text="{Binding MyTextUC1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/&gt;
     &lt;TextBox /&gt;
&lt;/StackPanel&gt;
</code></pre>

<p><em>UserControl1.xaml.cs</em></p>

<pre><code> public UserControl1()
 {
      InitializeComponent();
      this.DataContext = this;
 }

 public static readonly DependencyProperty MyTextUC1Property =
        DependencyProperty.Register("MyTextUC1", typeof(string),    typeof(UserControl1));

public string MyTextUC1
{
   get { return (string)GetValue(MyTextUC1Property); }
   set { SetValue(MyTextUC1Property, value); }
}
</code></pre>

<p><em>MainWindwo.xaml</em></p>

<pre><code>&lt;StackPanel&gt;
    &lt;local:UserControl1 x:Name="text1"/&gt;
    &lt;TextBlock Text="{Binding ElementName=text1, Path=MyTextUC1}" /&gt;
&lt;/StackPanel&gt;
</code></pre>

<p>On running this,   <strong>text changes in the <code>TextBox</code> of UserControl1 got reflected in <code>TextBlock</code> of MainWindow.</strong></p>

<h2><strong>Not Working:</strong></h2>

<blockquote>
  <p>UserControl1 >> UserControl2 >> MainWindow</p>
</blockquote>

<p>Created a UserControl(usercontrol1) and included it in another UserControl(usercontrol2) and then included the UserControl2 in mainWindow.  </p>

<p><em>UserControl1.xaml &amp; UserControl1.xaml.cs</em></p>

<pre><code>//Same as Working Code
</code></pre>

<p><em>UserControl2.xaml</em></p>

<pre><code>&lt;Grid&gt;
    &lt;local:UserControl1 x:Name="text2" MyTextUC1="{Binding MyTextUC2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/&gt;
&lt;/Grid&gt;
</code></pre>

<p><em>UserControl2.xaml.cs</em></p>

<pre><code> public UserControl2()
 {
     InitializeComponent();
     this.DataContext = this;
 }

 public static readonly DependencyProperty MyTextUC2Property =
     DependencyProperty.Register("MyTextUC2", typeof(string), typeof(UserControl2));       

 public string MyTextUC2
 {
     get { return (string)GetValue(MyTextUC2Property); }
     set { SetValue(MyTextUC2Property, value); }
 }
</code></pre>

<p><em>MainWindwo.xaml</em></p>

<pre><code>&lt;StackPanel&gt;
    &lt;local:UserControl2 x:Name="text1"/&gt;   //UserControl2 contains UserControl1
    &lt;TextBlock Text="{Binding ElementName=text1, Path=MyTextUC2}" /&gt;
&lt;/StackPanel&gt;
</code></pre>

<p>On Running this, <strong>text changes in the <code>TextBox</code> of UserControl2 NOT REFLECTED in <code>TextBlock</code> of MainWindow.</strong></p>

<p>I'm pretty sure that this is a basic thing in WPF and I may be implementing this in wrong way.  Can someone suggest me where I am wrong?  Thanks in advance.</p>