title: How to get name of DatagridTextColumn from DataGridColumnHeader using xaml
body: <p>I have the following xaml code defined for DataGridTextColumn of a DataGrid.</p>
  
  <pre><code>&lt;DataGridTextColumn x:Name="UserIdColumn" Binding="{Binding Path=UserId}" HeaderStyle="{StaticResource DataGridHeaderStyle}"/&gt;
  </code></pre>
  
  <p>And Here is the HeaderStyle for the DataGridTextColumn</p>
  
  <pre><code>&lt;Style x:Key="DataGridHeaderStyle" TargetType="{x:Type DataGridColumnHeader}"&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="DataGridColumnHeader"&gt;
                  &lt;StackPanel&gt;
                      &lt;TextBlock x:Name="ColumnName" Text="UserId" /&gt;
                      &lt;TextBox x:Name="UserIdFilter" Width="100"&gt;
                          &lt;i:Interaction.Triggers&gt;
                              &lt;i:EventTrigger EventName="TextChanged"&gt;
                                  &lt;cal:ActionMessage MethodName="UserIdFilterChanged"&gt;
                                      &lt;cal:Parameter Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridTextColumn}}, Path=Name}"/&gt;
                                      &lt;cal:Parameter Value="{Binding ElementName=UserIdFilter, Path=Text}" /&gt;
                                  &lt;/cal:ActionMessage&gt;
                              &lt;/i:EventTrigger&gt;
                          &lt;/i:Interaction.Triggers&gt;
                      &lt;/TextBox&gt;
                  &lt;/StackPanel&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;    
  </code></pre>
  
  <p>As one can see I am trying to access the DataGridTextColumn's <strong>Name</strong> property inside the DataGridColumnHeader's ControlTemplate using this line of code</p>
  
  <pre><code>&lt;cal:Parameter Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridTextColumn}}, Path=Name}"/&gt;
  </code></pre>
  
  <p>The above line is returning null, why ?</p>
  
  <p>Is there any other way to get hold of DataGridTextColumn's <strong>Name</strong> property from DataGridColumnHeader's control template ? </p>