title: Listbox with Grid as ItemPanelTemplate: Problem with SharedSizeGroup
body: <p>I have set up a <code>ListBox</code> where the items are another <code>ListBox</code>.
  This allows me to bind an observable collection that contains a list.</p>
  <p>I used an horizontal <code>StackPanel</code>as the <code>ItemsPanelTemplate</code> of the second <code>ListBox</code> but it was ugly so I tried to use a <code>Grid</code> instead (for the moment I fixed the number of columns to test if everything is working).</p>
  <p>Everything is in the correct cell, but it looks like the <code>SharedSizeGroup</code> is not taken in account, what I would like is that the cells of the same columns have the same width (the one of the widest element)</p>
  <p>See picture of what is happenning with my XAML code:</p>
  <p><a href="https://i.stack.imgur.com/BqS2x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BqS2x.png" alt="The items of the inner ListBoxes do not share size groups." /></a></p>
  <p>And what I would like to achieve</p>
  <p><a href="https://i.stack.imgur.com/iiGp1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iiGp1.png" alt="The items of the inner ListBoxes share size groups and are aligned." /></a></p>
  <p>I think that I did not place the <code>Grid.IsSharedSizeScope=&quot;True&quot;</code> to the proper place or maybe I did something else wrong.</p>
  <p>I know this looks like a <code>DataGrid</code> for now, but in the next step some lines may not have the same number of items.</p>
  <p>XAML Code</p>
  <pre><code>&lt;ListBox Grid.Row=&quot;1&quot; ItemsSource=&quot;{Binding LibraryGroupedValuesList}&quot;
                  SelectedItem=&quot;{Binding SelectedGroupedValues}&quot;&gt;
          &lt;ListBox.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                  &lt;Grid&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition Width=&quot;auto&quot;&gt;&lt;/ColumnDefinition&gt;
                          &lt;ColumnDefinition Width=&quot;*&quot;&gt;&lt;/ColumnDefinition&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
  
                      &lt;TextBlock Text=&quot;{Binding Position}&quot; VerticalAlignment=&quot;Center&quot;&gt;
                      &lt;/TextBlock&gt;
                      &lt;ListBox Grid.IsSharedSizeScope=&quot;True&quot; Grid.Column=&quot;1&quot; ItemsSource=&quot;{Binding PositionValues}&quot; 
                          ItemTemplateSelector=&quot;{StaticResource VariableTypeTemplateSelector}&quot;
                          HorizontalContentAlignment=&quot;Stretch&quot; &gt;
                          &lt;ListBox.ItemsPanel&gt;
                              &lt;ItemsPanelTemplate&gt;
                                  &lt;Grid&gt;
                                      &lt;Grid.ColumnDefinitions&gt;
                                          &lt;ColumnDefinition Width=&quot;auto&quot; SharedSizeGroup=&quot;1&quot;&gt;&lt;/ColumnDefinition&gt;
                                          &lt;ColumnDefinition Width=&quot;auto&quot; SharedSizeGroup=&quot;2&quot;&gt;&lt;/ColumnDefinition&gt;
                                          &lt;ColumnDefinition Width=&quot;auto&quot; SharedSizeGroup=&quot;3&quot;&gt;&lt;/ColumnDefinition&gt;
                                          &lt;ColumnDefinition Width=&quot;auto&quot; SharedSizeGroup=&quot;4&quot;&gt;&lt;/ColumnDefinition&gt;
                                          &lt;ColumnDefinition Width=&quot;auto&quot; SharedSizeGroup=&quot;5&quot;&gt;&lt;/ColumnDefinition&gt;
                                          &lt;ColumnDefinition Width=&quot;*&quot;&gt;&lt;/ColumnDefinition&gt;
                                      &lt;/Grid.ColumnDefinitions&gt;
                                  &lt;/Grid&gt;
                              &lt;/ItemsPanelTemplate&gt;
                          &lt;/ListBox.ItemsPanel&gt;
                          &lt;ListBox.ItemContainerStyle&gt;
                              &lt;Style TargetType=&quot;ListBoxItem&quot;&gt;
                                  &lt;Style.Setters&gt;
                                      &lt;Setter Property=&quot;Grid.Column&quot; Value=&quot;{Binding Index}&quot;/&gt;
                                  &lt;/Style.Setters&gt;
                              &lt;/Style&gt;
                          &lt;/ListBox.ItemContainerStyle&gt;
                      &lt;/ListBox&gt;
                  &lt;/Grid&gt;
              &lt;/DataTemplate&gt;
          &lt;/ListBox.ItemTemplate&gt;
      &lt;/ListBox&gt;
  &lt;/Grid&gt;
  </code></pre>