title: Binding error from the treeview control
body: <p>I faced one issue and I would really appreciate it if you could provide any advice for this.</p>
  
  <p>Error message:</p>
  
  <blockquote>
    <p>System.Windows.Data Error: 4 : Cannot find source for binding with
    reference 'RelativeSource FindAncestor,
    AncestorType='System.Windows.Controls.ItemsControl',
    AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment;
    DataItem=null; target element is 'TreeViewItem' (Name=''); target
    property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')</p>
  </blockquote>
  
  <p>I have a treeview control (C# WPF .NET 4.0), and several items are added into this treeview by using datatemplate in xaml or manually, and both uses data binding.</p>
  
  <p>When new data structure is received, I need to clean all items in treeview and regenerate new one by <code>treeview_Control.Items.Clear()</code> and it seems working fine from GUI point of view, but when I see output window on Visual Studio it shows several error messages as like above.</p>
  
  <p>I've tried to search for a solution and tried several methods but no luck yet. Someone just recommended to just ignore this error message, but I just really want to clear this up.</p>
  
  <p>If you have any idea, please help me for this.</p>