<UserControl x:Class="InABox.DynamicGrid.FormHeader"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:InABox.DynamicGrid"
             mc:Ignorable="d"
             x:Name="UserControl">

    <UserControl.Resources>
        <Style TargetType="Image">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=Collapsed, ElementName=UserControl}" Value="False">
                    <Setter Property="RenderTransform">
                        <Setter.Value>
                            <RotateTransform Angle="90"/>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>

    <Button Click="Button_Click" HorizontalContentAlignment="Left" Cursor="Hand"
            Background="{Binding Path=Background, ElementName=UserControl}" BorderBrush="Transparent">
        <StackPanel Orientation="Horizontal">
            <Image Width="32" Height="32"
                   RenderTransformOrigin="0.5,0.5" Source="../../../Resources/header_closed.png"/>
            <TextBlock x:Name="TextBlock" 
                       Text="{Binding Path=HeaderText, ElementName=UserControl}" 
                       FontWeight="{Binding Path=FontWeight, ElementName=UserControl}"
                       FontStyle="{Binding Path=FontStyle, ElementName=UserControl}"
                       Foreground="{Binding Path=Foreground,ElementName=UserControl}"
                       TextAlignment="Left"
                       VerticalAlignment="Center"/>
        </StackPanel>
    </Button>
</UserControl>
