title: Visibility of a child Control not working inside parent
body: <p>I have a <code>StackPanel</code> inside a <code>Grid</code> which is inside a <code>UserControl</code>. I have set the Visibility of the <code>StackPanel</code> based on a property called <code>ShowInstrumentAction</code> that is present in the <code>ViewModel</code>, which is set as a <code>DataContext</code>. This operation works just fine. </p>
  
  <p>But I have a button inside this <code>StackPanel</code> (please see <code>PrimeFlush3TimesButton</code>) which I want it to be visible based on some other condition. But the child level visibility won't work. </p>
  
  <p>Is it possible  to do this kind of binding?<br>
  Or should I write a style for Visibility on the button?<br>
  I'm not sure what may be the right approach. Please help. </p>
  
  <pre><code>&lt;StackPanel x:Name="InstrumentOperationsPanel" Visibility="{Binding DataContext.ShowInstrumentAction,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}},Converter={StaticResource boolToVisibility}}" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Center"&gt;
      &lt;Button x:Name="PrimeButton"
              Content="{StaticResource InstrumentPrime}"
              Margin="{StaticResource AllControlsMargin}" Command="{Binding DataContext.InstrumentPrimeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}"&gt;
      &lt;/Button&gt;
      &lt;Button x:Name="FlushButton"
              Content="{StaticResource InstrumentFlush}"
              Margin="{StaticResource AllControlsMargin}" Command="{Binding DataContext.InstrumentFlushCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}"&gt;
      &lt;/Button&gt;
      &lt;Button x:Name="PrimeFlush3TimesButton"
              Content="{StaticResource PrimeAndFlush3Times}"
              Margin="{StaticResource AllControlsMargin}"
              Visibility="{Binding DataContext.IsBuiltInUser,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl},AncestorLevel=3},Converter={StaticResource boolToVisibility}}"
              Command="{Binding DataContext.InstrumentPrimeAndFlush3TimesCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}"&gt;
      &lt;/Button&gt;
  &lt;/StackPanel&gt;
  </code></pre>