title: gridview column auto size not working on loading except with hot reload
body: <p>When I load my list, my column size is set to &quot;auto&quot;. I would like my column to automatically take the size of my longest string, so as not to &quot;cut&quot; the strings.</p>
  <p>For the first column, we see that everything is fine. For the second one, which is exactly the same except for the font style, it doesn't work, we see that the names are cut.</p>
  <p><a href="https://i.stack.imgur.com/9Ymn0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Ymn0.png" alt="enter image description here" /></a></p>
  <p>However, if I change &quot;auto&quot; to a value, for example 10, and then back to &quot;auto&quot;, everything works with an horizontal scrollbar:</p>
  <p><a href="https://i.stack.imgur.com/HcDSv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HcDSv.png" alt="enter image description here" /></a></p>
  <p>If it works with hot reload and for the first column, what can explain that my second column does not fit the size of my strings?</p>
  <p>My list is a collection of objects composed with 2 strings. My code :</p>
  <pre><code>                &lt;ListView
                      BorderBrush=&quot;SteelBlue&quot;
                      ItemsSource=&quot;{Binding ListeAgentsAAfficher}&quot;
                      SelectedItem=&quot;{Binding AgentSelected}&quot;&gt;
                      &lt;ListView.ContextMenu&gt;
                          &lt;ContextMenu&gt;
                              &lt;MenuItem
                                  Command=&quot;{Binding AfficherSupprimerCommand}&quot;
                                  Header=&quot;Afficher agents supprimés&quot;
                                  IsCheckable=&quot;True&quot;
                                  IsChecked=&quot;{Binding IsCheckedSupprimer}&quot; /&gt;
                              &lt;MenuItem
                                  Command=&quot;{Binding TriAgentsMatriculesCommand}&quot;
                                  Header=&quot;Trier par matricules&quot;
                                  IsCheckable=&quot;True&quot;
                                  IsChecked=&quot;{Binding IsCheckedTriMatricule}&quot; /&gt;
                              &lt;MenuItem
                                  Command=&quot;{Binding TriAgentsNomCommand}&quot;
                                  Header=&quot;Trier par noms&quot;
                                  IsCheckable=&quot;True&quot;
                                  IsChecked=&quot;{Binding IsCheckedTriNom}&quot; /&gt;
                          &lt;/ContextMenu&gt;
                      &lt;/ListView.ContextMenu&gt;
                      &lt;ListView.Resources&gt;
                          &lt;Style TargetType=&quot;ListViewItem&quot;&gt;
                              &lt;Setter Property=&quot;Background&quot; Value=&quot;White&quot; /&gt;
                              &lt;Style.Triggers&gt;
                                  &lt;DataTrigger Binding=&quot;{Binding Supprimer}&quot; Value=&quot;true&quot;&gt;
                                      &lt;Setter Property=&quot;Foreground&quot; Value=&quot;DarkOrange&quot; /&gt;
                                  &lt;/DataTrigger&gt;
                              &lt;/Style.Triggers&gt;
                          &lt;/Style&gt;
                      &lt;/ListView.Resources&gt;
                      &lt;ListView.View&gt;
                          &lt;GridView&gt;
                              &lt;GridView.ColumnHeaderContainerStyle&gt;
                                  &lt;Style TargetType=&quot;GridViewColumnHeader&quot;&gt;
                                      &lt;Setter Property=&quot;Visibility&quot; Value=&quot;Collapsed&quot; /&gt;
                                  &lt;/Style&gt;
                              &lt;/GridView.ColumnHeaderContainerStyle&gt;
                              &lt;GridViewColumn Width=&quot;auto&quot;&gt;
                                  &lt;GridViewColumnHeader /&gt;
                                  &lt;GridViewColumn.CellTemplate&gt;
                                      &lt;DataTemplate&gt;
                                          &lt;TextBlock
                                              HorizontalAlignment=&quot;center&quot;
                                              VerticalAlignment=&quot;center&quot;
                                              FontSize=&quot;10&quot;
                                              FontWeight=&quot;Bold&quot;
                                              Text=&quot;{Binding Matricule}&quot; /&gt;
                                      &lt;/DataTemplate&gt;
                                  &lt;/GridViewColumn.CellTemplate&gt;
                              &lt;/GridViewColumn&gt;
                              &lt;GridViewColumn Width=&quot;auto&quot;&gt;
                                  &lt;GridViewColumn.CellTemplate&gt;
                                      &lt;DataTemplate&gt;
                                          &lt;TextBlock
                                              HorizontalAlignment=&quot;center&quot;
                                              VerticalAlignment=&quot;center&quot;
                                              Text=&quot;{Binding Nom}&quot; /&gt;
                                      &lt;/DataTemplate&gt;
                                  &lt;/GridViewColumn.CellTemplate&gt;
                              &lt;/GridViewColumn&gt;
                          &lt;/GridView&gt;
                      &lt;/ListView.View&gt;
                  &lt;/ListView&gt;
  </code></pre>