title: WP8 Binding DependencyProperty of a custom Button to another DependencyProperty of a UserControl not work
body: <p>Let's say I have two UserControl: <code>uc1</code> and <code>uc2</code>.  <code>uc1</code> is derived from <code>Button</code>, <code>uc2</code> is derived from <code>UserControl</code>.</p>
  
  <p><code>uc1</code> has a <code>DependencyProperty</code> <code>isTextShow</code>:</p>
  
  <p>C#:  </p>
  
  <pre><code>public static readonly DependencyProperty isTextShowProperty = DependencyProperty.Register(
      "isTextShow", 
      typeof(bool), 
      typeof(uc1),
      new PropertyMetadata(true));
  
  public bool isTextShow
  {
      get { return (bool)GetValue(isTextShowProperty ); }
      set { SetValue(isTextShowProperty , value); } 
  }
  </code></pre>
  
  <p>XAML:</p>
  
  <pre><code>&lt;Button x:Class="xx.xx.uc1"
      ....
      x:Name="ButtonBase"&gt;
  
      &lt;TextBlock 
          ..
          Visibility="{Binding ElementName=ButtonBase, Path=isTextShow, Converter="{StaticResource BoolToVisibilityConverter}"}"&gt;
      &lt;/TextBlock&gt;
      ....     
  &lt;/Button&gt;
  </code></pre>
  
  <hr>
  
  <p><code>uc2</code> has a <code>DependencyProperty</code> <code>isWhatEver</code>:</p>
  
  <p>C#:  </p>
  
  <pre><code>public static readonly DependencyProperty isWhatEverProperty = DependencyProperty.Register(
      "isWhatEver", 
      typeof(bool), 
      typeof(uc2),
      new PropertyMetadata(true));
  
  public bool isWhatEver
  {
      get { return (bool)GetValue(isWhatEverProperty ); }
      set { SetValue(isWhatEverProperty , value); } 
  }
  </code></pre>
  
  <p>XAML:</p>
  
  <pre><code>&lt;UserControl x:Class="xx.xx.uc2"
      ....
      x:Name="UCBase"&gt;
  
      &lt;uc1
          ..
          isTextShow="{Binding ElementName=UCBase, Path=isWhatEver}"&gt;
      &lt;/uc1&gt;
      ....     
  </code></pre>
  
  <h2>    </h2>
  
  <p>Now I use <code>uc2</code> in some places like below:</p>
  
  <pre><code>&lt;uc2 
      ....
      isWhatEver="False"
  /&gt;
  </code></pre>
  
  <p>I predicted that after this, the <code>TextBlock</code> in <code>uc1</code> would not show, but the result is it is still visible.<br>
  I made breakpoint in some essential places and found that the <code>isWhatEver</code> became False, but the <code>isTextShow</code> of <code>uc1</code> bound to it was still True.  It seems something wrong with this Binding.</p>
  
  <p>Further more, I changed this line: </p>
  
  <pre><code>isTextShow="{Binding ElementName=UCBase, Path=isWhatEver}" 
  </code></pre>
  
  <p>to </p>
  
  <pre><code>isTextShow="False", 
  </code></pre>
  
  <p>This time, the <code>TextBlock</code> in <code>uc1</code> didn't show up.  So it means the first layer binding works fine, but the second layer(Binding DependencyProperty of UserControl one to another DependencyProperty of UserControl two) doesn't work.</p>
  
  <p>Is there anything important I ignored?  Thank you.</p>
  
  <hr>
  
  <p>Update:
  I think now I know the reason, but I still don't know the solution.
  The reason is: <code>uc1</code> is derived from <code>Button</code>; if I change <code>uc1</code> to be derived from <code>UserControl</code>, it works fine!  But for current situation, I really need make <code>uc1</code> as a child of <code>Button</code>, so any ideas?</p>