title: Some children are not shown in stack panel
body: <p><strong>EDIT #2:</strong></p>
  
  <p>Here's a minimal <a href="https://github.com/sidgo28/Bugs.UWP" rel="nofollow noreferrer">Github Repo</a> I created to reproduce the problem.</p>
  
  <hr>
  
  <p>I believe this is a bug in the implementation of virtualization of a grouped ListViewBase when some groups are empty</p>
  
  <p>I have a listview whose items panel is set to StackPanel since I need to set the group style panel to a staggered panel which doesn't work well with item stack panel.</p>
  
  <p>The problem now is, out of 27 groups, only 16 groups are shown. I tested it on another list view and I confirmed that the problem is that the stack panel only displays a limited number of children (the strange thing is it's not 16 on my test but 22).</p>
  
  <p>I tried VirtualizingStackPanel but unlike StackPanel, I can't seem to center it inside the list view upon setting its MaxWidth though it displays all its children.</p>
  
  <p>Here's my XAML:</p>
  
  <pre><code>  &lt;ListView ItemsSource="{Binding Source={StaticResource NoteViewSource}}"
                Padding="0 0"
                ItemTemplate="{StaticResource NormalNoteTemplate}"
                x:Name="ListView"
                IsItemClickEnabled="True"
                ItemClick="ListView_OnItemClick"
                SelectionChanged="ListView_OnSelectionChanged"
                SelectionMode="Extended"&gt;
          &lt;ListView.Footer&gt;
              &lt;Border Height="80" /&gt;
          &lt;/ListView.Footer&gt;
          &lt;ListView.GroupStyle&gt;
              &lt;GroupStyle HidesIfEmpty="False"&gt;
                  &lt;GroupStyle.HeaderTemplate&gt;
                      &lt;DataTemplate x:DataType="viewModels:NoteList"&gt;
                              &lt;TextBlock Text="{x:Bind Header, Mode=OneWay}"
                                         FontSize="18"
                                         Margin="0,16,0,8"
                                         FontWeight="Bold" /&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/GroupStyle.HeaderTemplate&gt;
                  &lt;GroupStyle.Panel&gt;
                      &lt;ItemsPanelTemplate&gt;
                          &lt;uwp:SGStaggeredPanel DesiredColumnWidth="220"/&gt;
                      &lt;/ItemsPanelTemplate&gt;
                  &lt;/GroupStyle.Panel&gt;
              &lt;/GroupStyle&gt;
          &lt;/ListView.GroupStyle&gt;
          &lt;ListView.ItemsPanel&gt;
              &lt;ItemsPanelTemplate&gt;
                  &lt;!-- custom group panel won't work if this is item panel--&gt;
                  &lt;StackPanel /&gt;
              &lt;/ItemsPanelTemplate&gt;
          &lt;/ListView.ItemsPanel&gt;
      &lt;/ListView&gt;
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>I inspected it further and it seems that the StackPanel is not the problem since its Children count is 22. This means it has the wrong count of children which means the problem is in the CollectionViewSource or the ListView passing only 22 items in the StackPanel rather than the full count.</p>
  
  <p>But what I can't understand is why does the VirtualizingStackPanel work??</p>