Example of Expander in WPF

This example describes how to use Expander in WPF.

<Window x:Class="LayoutDemo.wndExpander"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="wndExpander" Height="300" Width="300">

  <Grid>

    <Expander Header="This goes to Header" Margin="50" IsExpanded="True" ExpandDirection="Down">

      <StackPanel>

        <Image Height="140" Source="/LayoutDemo;component/toofast.jpg" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></Image>

      </StackPanel>

    </Expander>

    <Expander Header="This goes to Header" Margin="50" IsExpanded="True" ExpandDirection="Down" Expanded="Expander_Expanded">

      <StackPanel>

        <Image Height="140" Source="/LayoutDemo;component/Images/Penguins.jpg" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></Image>

      </StackPanel>

    </Expander>

  </Grid>

</Window>