title: Fix binding error for a binding applied in a style
body: <p>I am getting a binding error in my output panel when I run my application:</p>
  
  <blockquote>
    <p>System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Shapes.Ellipse', AncestorLevel='1''. BindingExpression:Path=Width; DataItem=null; target element is 'TranslateTransform' (HashCode=59715965); target property is 'X' (type 'Double')</p>
  </blockquote>
  
  <p>I am trying to create a style that would apply a TranslateTransform on all the ellipses in a Canvas. The binding works, but when I start my application, I get the error in my Output panel. How can I fix this error?</p>
  
  <p><strong>EDIT: The binding does work, I just want to get rid of the error in the Visual Studio Output window.</strong></p>
  
  <p>If I move the RenderTransform from the style into the <code>Ellipse</code> tag, the error goes away, but I want this transform to be used from within a style because it needs to get applied to many ellipses.</p>
  
  <p>This is the XAML I am using:</p>
  
  <pre><code>&lt;Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          x:Class="WpfApplication1.MainWindow"
          Title="MainWindow" Height="300" Width="300"&gt;
      &lt;Window.Resources&gt;
          &lt;Style TargetType="Ellipse"&gt;
              &lt;Setter Property="RenderTransform"&gt;
                  &lt;Setter.Value&gt;
                      &lt;TranslateTransform&gt;
                          &lt;TranslateTransform.X&gt;
                              &lt;Binding 
                                      RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type Ellipse}}"
                                      Path="Width"/&gt;
                          &lt;/TranslateTransform.X&gt;
                      &lt;/TranslateTransform&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
      &lt;/Window.Resources&gt;
      &lt;Canvas&gt;
          &lt;Ellipse Width="100" Height="100" Fill="Red" /&gt;
      &lt;/Canvas&gt;
  &lt;/Window&gt;
  </code></pre>