title: How can I group GridViewColumns in WPF, so the expander fills the whole width
body: <p>I am new to WPF and try to do the following:</p>
  
  <p>I have a ListView with a ItemsSource using a ViewModel.
  Inside, there is a GridView with Columns. Each Column represents a Preoperty of the View Model. But the Description is optional and can be rather long. So I want to use a Expander. My Problem is, that I can only manage the expander to be as big as the Name-Column. But I want the expander to be as big as the whole row.
  Here are 2 Images to clarify what I want.</p>
  
  <p>My current State:
  <a href="https://i.stack.imgur.com/ZNA4v.png" rel="nofollow noreferrer">https://i.stack.imgur.com/ZNA4v.png</a></p>
  
  <p>What I want to achieve:
  <a href="https://i.stack.imgur.com/ZmFq1.png" rel="nofollow noreferrer">https://i.stack.imgur.com/ZmFq1.png</a></p>
  
  <p>I tried "grouping the GridView" but without success... See here
  <a href="http://technico.qnownow.com/grouping-gridview-wpf/" rel="nofollow noreferrer">http://technico.qnownow.com/grouping-gridview-wpf/</a></p>
  
  <p>Here's my Code</p>
  
  <pre><code>&lt;Window ...&gt;
  &lt;Window.Resources&gt;
      ...
  &lt;/Window.Resources&gt;
  &lt;DockPanel&gt;
      &lt;StackPanel DockPanel.Dock="Top"&gt;
          ...
      &lt;/StackPanel&gt;
      &lt;Grid&gt;            
          &lt;ListView Grid.RowSpan="4" DockPanel.Dock="Top" Margin="10" ItemsSource="{Binding MyView}"&gt;
              &lt;ListView.ItemContainerStyle&gt;
                  &lt;Style TargetType="{x:Type ListViewItem}"&gt;
                      &lt;Setter Property="BorderBrush" Value="Black"&gt;&lt;/Setter&gt;
                      &lt;Setter Property="BorderThickness" Value="0,0,0,1"&gt;&lt;/Setter&gt;
                      &lt;Setter Property="Focusable" Value="False" /&gt;
                      &lt;Setter Property="HorizontalAlignment" Value="Stretch" /&gt;
                      &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt;
                      &lt;Setter Property="VerticalAlignment" Value="Top"&gt;&lt;/Setter&gt;
                      &lt;Setter Property="VerticalContentAlignment" Value="Top"&gt;&lt;/Setter&gt;
                  &lt;/Style&gt;
              &lt;/ListView.ItemContainerStyle&gt;
  
              &lt;!-- New GridView --&gt;
              &lt;ListView.View&gt;
                  &lt;GridView&gt;
  
                      &lt;!--Number--&gt;
                      &lt;GridViewColumn Header="#"&gt;
                          &lt;GridViewColumn.CellTemplate&gt;
                              &lt;DataTemplate DataType="viewModel:MyViewModel"&gt;
                                  &lt;TextBlock Text="{Binding Model.Number, StringFormat='#{0}', Mode=OneWay}"
                                                 Width="20" TextAlignment="Left" Margin="5" VerticalAlignment="Top" /&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/GridViewColumn.CellTemplate&gt;
                      &lt;/GridViewColumn&gt;
  
                      &lt;!--ErrorLevel--&gt;
                      &lt;GridViewColumn Header="" Width="45"&gt;
                          &lt;GridViewColumn.CellTemplate&gt;
                              &lt;DataTemplate DataType="viewModel:MyViewModel"&gt;
                                  &lt;Image Source="{Binding Model.ErrorLevel, Converter={StaticResource ErrorLevelToImageConverter}, Mode=OneWay}"
                                             ToolTip="{Binding Model.ErrorLevel, Mode=OneWay}" Width="20" Margin="5" VerticalAlignment="Top" /&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/GridViewColumn.CellTemplate&gt;
                      &lt;/GridViewColumn&gt;
  
                      &lt;!--ID--&gt;
                      &lt;GridViewColumn Header="ID"&gt;
                          &lt;GridViewColumn.CellTemplate&gt;
                              &lt;DataTemplate DataType="viewModel:MyViewModel"&gt;
                                  &lt;TextBlock TextAlignment="Center" Margin="5" Width="50" VerticalAlignment="Top" &gt;
                                          &lt;Hyperlink NavigateUri="{Binding Model.Hyperlink, Mode=OneWay}"
                                                     Command="{Binding HyperlinkCommand}"&gt;
                                              &lt;TextBlock Text="{Binding Model.Id, Mode=OneWay}" /&gt;
                                          &lt;/Hyperlink&gt;
                                      &lt;/TextBlock&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/GridViewColumn.CellTemplate&gt;
                      &lt;/GridViewColumn&gt;
  
                      &lt;!--Name--&gt;
                      &lt;GridViewColumn Header="Name" Width="500" &gt;
                          &lt;GridViewColumn.CellTemplate&gt;
                              &lt;DataTemplate DataType="viewModel:MyViewModel"&gt;
                                  &lt;Expander ToolTip="Expand" ExpandDirection="Down" Foreground="Black" VerticalAlignment="Top"&gt;
                                      &lt;Expander.Header&gt;
                                          &lt;TextBlock Text="{Binding Model.Name, Mode=OneWay}"
                                                 HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource AncestorType=ContentPresenter}, Mode=OneWayToSource}"
                                                 TextAlignment="Left" Margin="5" TextWrapping="Wrap" VerticalAlignment="Top" /&gt;
                                      &lt;/Expander.Header&gt;
                                      &lt;GroupBox Header="Description" FontWeight="Bold" &gt;
                                          &lt;TextBlock Text="{Binding Model.Description, Mode=OneWay}" TextWrapping="Wrap"
                                                         FontWeight="Normal" TextAlignment="Left" Margin="5" /&gt;
                                      &lt;/GroupBox&gt;
                                  &lt;/Expander&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/GridViewColumn.CellTemplate&gt;
                      &lt;/GridViewColumn&gt;
  
                      &lt;!-- Module--&gt;
                      &lt;GridViewColumn Header="Module" &gt;
                          &lt;GridViewColumn.CellTemplate&gt;
                              &lt;DataTemplate DataType="viewModel:MyViewModel"&gt;
                                  &lt;TextBlock Text="{Binding Model.Module, Mode=OneWay}"
                                                 TextAlignment="Center" Margin="5" Width="100" /&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/GridViewColumn.CellTemplate&gt;
                      &lt;/GridViewColumn&gt;
  
                  &lt;/GridView&gt;
              &lt;/ListView.View&gt;
          &lt;/ListView&gt;
      &lt;/Grid&gt;
  &lt;/DockPanel&gt;
  </code></pre>
  
  <p></p>
  
  <p>Once again, i am new to WPF, MVVM, DataBinding and all this. So please try to make your answer as detailed as possible. I tried many things, but they didn't work out. </p>