<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI">

    <Style TargetType="{x:Type ui:SectionControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ui:SectionControl}">
                    <Grid>
                        <Grid.Resources>
                            <BooleanToVisibilityConverter x:Key="b2v"/>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>

                        <ToggleButton Grid.Column="0" Grid.Row="0" 
                                      IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                      VerticalAlignment="Stretch"
                                      Margin="0 0 4 0"
                                      Width="10">
                            <ToggleButton.Template>
                                <ControlTemplate TargetType="ToggleButton">
                                    <Border Background="Transparent">
                                        <Path Name="Arrow"
                                              Fill="{DynamicResource VsBrush.WindowText}"
                                              Height="7"
                                              Width="7"
                                              Stretch="UniformToFill"
                                              Data="M7 1l-.025 5H2z"
                                              VerticalAlignment="Center"
                                              HorizontalAlignment="Center"/>
                                    </Border>

                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsChecked" Value="False">
                                            <Setter TargetName="Arrow" Property="LayoutTransform">
                                                <Setter.Value>
                                                    <RotateTransform Angle="-45" />
                                                </Setter.Value>
                                            </Setter>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </ToggleButton.Template>
                        </ToggleButton>

                        <TextBlock Grid.Column="1" Grid.Row="0"
                                   FontWeight="SemiBold"
                                   Text="{TemplateBinding HeaderText}"/>

                        <ItemsControl Grid.Column="2" Grid.Row="0" ItemsSource="{TemplateBinding Buttons}"/>

                        <ContentPresenter Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="1" 
                                          Visibility="{TemplateBinding IsExpanded, Converter={StaticResource b2v}}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>