<UserControl x:Class="SicUI.Controls.Door"
             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:SicUI.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="20" d:DesignWidth="100">
    <UserControl.Resources>
 
        <Storyboard x:Key="Door_Open">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" >
                <EasingDoubleKeyFrame KeyTime="0" Value="55"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="15"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Key="Door_Close">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" >
                <EasingDoubleKeyFrame KeyTime="0" Value="15"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="55"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Style TargetType="{x:Type Rectangle}" x:Key="Door_Animation" >
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsDoorOpen}" Value="true">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource Door_Open}"/>
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                        <BeginStoryboard Storyboard="{StaticResource Door_Close}"/>
                    </DataTrigger.ExitActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>

      </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Rectangle x:Name="Door_Top" Style="{StaticResource Door_Animation}" Fill="DimGray"   />
        <Rectangle x:Name="Door_Bottom" Grid.Column="1" Style="{StaticResource Door_Animation}" Fill="DimGray"  />
    </Grid>
</UserControl>
