title: Create a ListBox with items that expand when selected (Accordion)
body: <p>There's solutions to this problem for older XAML based UI frameworks (WPF/SL) but they're not easily adaptable to the Universal Windows Platform.</p>
  
  <p>I'm trying to create a list of items that show only limited details in default state and expands, when it's selected, to quickly edit some data.<br>
  I have not found a way to create a that expanding behavior, though it is similar to what the Windows 10 Mail app does, with conversations. When a message of a conversation is selected, the other messages of that conversation kind of drop down or slide down.</p>
  
  <p>Below is an example of a list where I'd like to display only the name at first.</p>
  
  <pre><code>&lt;ListBox ItemsSource="{x:Bind Persons}"&gt;
      &lt;ListBox.ItemContainerStyle&gt;
          &lt;Style TargetType="ListBoxItem"&gt;
              &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt;
          &lt;/Style&gt;
      &lt;/ListBox.ItemContainerStyle&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate x:DataType="src:Person"&gt;
              &lt;StackPanel HorizontalAlignment="Stretch" Width="Auto"&gt;
                  &lt;TextBlock Text="{x:Bind Path=Name, Mode=OneWay}" Margin="12, 15, 12, 0" FontSize="18.667" /&gt;
                  &lt;TextBox HorizontalAlignment="Stretch" Margin="12, 12, 12, 0" FontSize="18.667" Text="{x:Bind Path=Name, Mode=TwoWay}" /&gt;
                  &lt;TextBlock Text="Date of birth" Margin="12, 15, 12, 0" /&gt;
                  &lt;DatePicker Margin="12, 5, 12, 0" Date="{x:Bind Path=DateOfBirth, Mode=TwoWay}" /&gt;
                  &lt;TextBlock Text="Domicile" Margin="12, 15, 12, 0" /&gt;
                  &lt;TextBox Margin="12, 5, 12, 0" Text="{x:Bind Path=Domicile, Mode=OneWay}" /&gt;
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>In WPF, such behavior could be achieved with triggers <code>Style.Triggers</code> but they're not available anymore.</p>
  
  <p>Original Source Code on <a href="https://github.com/elessar-ch/uwp-list-box-test/blob/master/ListBoxTest/MainPage.xaml" rel="noreferrer">GitHub</a></p>