title: How can I get, the ListViewControl on GridViewColumnHeader Click Event
body: <p>I have 7 different ListViews.</p>
  
  <p>There is a Sortmethod called <code>SortClick(object sender, RoutedEventArgs e)</code> -
  when clicking on a GridViewColumnHeader, it raises the SortClick Event.</p>
  
  <p>But in this method I must tell, which ListView should be Sorted, b.e</p>
  
  <pre><code>listview2.SortNow();
  </code></pre>
  
  <p>Now my Question is, how can I get the Control (ListView) from the GridViewColumnHeader (<code>sender</code>) or maybe the <code>e</code>, is that even possible?</p>
  
  <p>How the ListView XAML looks like:</p>
  
  <pre><code>&lt;ListView ItemsSource="{Binding MissingTables}" Name="missingTablesListView" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0" MinHeight="540" HorizontalContentAlignment="Stretch"&gt;
                      &lt;ListView.Background&gt;
                          &lt;ImageBrush /&gt;
                      &lt;/ListView.Background&gt;
                      &lt;ListView.View&gt;
                          &lt;GridView&gt;
                              &lt;GridViewColumn DisplayMemberBinding="{Binding TableName}" Width="Auto"&gt;
                                  &lt;GridViewColumnHeader Click="SortClick" Content="TableName" Tag="TableName" ToolTip="Sortieren" /&gt;
                              &lt;/GridViewColumn&gt;   
                              &lt;GridViewColumn DisplayMemberBinding="{Binding Beschreibung}" Width="Auto"&gt;
                                  &lt;GridViewColumnHeader Click="SortClick" Content="Description" Tag="Beschreibung" ToolTip="Sortieren" /&gt;
                              &lt;/GridViewColumn&gt;
                          &lt;/GridView&gt;
                      &lt;/ListView.View&gt;
                  &lt;/ListView&gt;
  </code></pre>
  
  <p>Here is the SortClick Code:</p>
  
  <pre><code>        /// &lt;summary&gt;
          /// Sortiert (Ascending/Descending)
          /// &lt;/summary&gt;
          /// &lt;param name="sender"&gt;sender&lt;/param&gt;
          /// &lt;param name="e"&gt;e&lt;/param&gt;
          private void SortClick(object sender, RoutedEventArgs e)
          {       
              //ListView listView = sender as ListView;
  
              GridViewColumnHeader column = sender as GridViewColumnHeader;
              String field = column.Tag as String;
  
              if (currentSortColumn != null)
              {
                  AdornerLayer.GetAdornerLayer(currentSortColumn).Remove(sorter);
                  listView.Items.SortDescriptions.Clear();
              }
  
              ListSortDirection newDir = ListSortDirection.Ascending;
              if (currentSortColumn == column &amp;&amp; sorter.Direction == newDir)
              {
                  newDir = ListSortDirection.Descending;
              }
  
              currentSortColumn = column;
              sorter = new Sorter(currentSortColumn, newDir);
              AdornerLayer.GetAdornerLayer(currentSortColumn).Add(sorter);
              listView.Items.SortDescriptions.Add(new SortDescription(field, newDir));
          }
  </code></pre>