title: Attached property not working properly on control
body: <p>When I declare a property as normal dependency property then it works however when declared it as attached, it doesn't. I am not sure, what am I missing here. Please help. Following is the code. </p>
  
  <p><strong>(Set 1 with dependency property works good but Set 2 with attached dependency property doesn't)</strong></p>
  
  <pre><code>&lt;StackPanel Name="PanelControl"  Orientation="{Binding ElementName=MainWindow, Path=ControlOrientation, Converter={StaticResource ResourceKey=LocalConvertor}}"/&gt;
  </code></pre>
  
  <p><strong>Set 1</strong></p>
  
  <pre><code>FrameworkPropertyMetadata metaData1 = new FrameworkPropertyMetadata(Orientation.Vertical, FrameworkPropertyMetadataOptions.AffectsRender);                     
  ControlOrientationProperty = DependencyProperty.RegisterAttached("ControlOrientation", typeof(Orientation), typeof(CustomTextBoxUsingDependencyProperty), metaData1); 
  
  public Orientation ControlOrientation
  {
      get { return (Orientation)(GetValue(ControlOrientationProperty)); }
      set { SetValue(ControlOrientationProperty, value); }
  }
  </code></pre>
  
  
  
  <pre><code> &lt;clist:CustomTextBoxUsingDependencyProperty Width="742" Height="100" ControlOrientation="Horizontal"/&gt;
  </code></pre>
  
  <p><strong>Set 2</strong></p>
  
  <pre><code>ControlOrientationProperty = DependencyProperty.RegisterAttached("ControlOrientation", typeof(Orientation), typeof(CustomTextBoxUsingDependencyProperty), metaData1); 
  
  public static void SetControlOrientation(UIElement element, Orientation value)
  {
      element.SetValue(CustomTextBoxUsingDependencyProperty.ControlOrientationProperty, value);
  }
  public static Orientation GetControlOrientation(UIElement element)
  {
      return (Orientation)element.GetValue(CustomTextBoxUsingDependencyProperty.ControlOrientationProperty);
  }
  </code></pre>
  
  
  
  <pre><code>&lt;clist:CustomTextBoxUsingDependencyProperty Width="742" Height="100"&gt;
      &lt;Button Content="Test" clist:CustomTextBoxUsingDependencyProperty.ControlOrientation="Horizontal"/&gt;
  &lt;/clist:CustomTextBoxUsingDependencyProperty&gt;
  </code></pre>