<UserControl x:Class="Filtration.Views.UpdateView"
             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:designTime="clr-namespace:Filtration.ViewModels.DesignTime"
             mc:Ignorable="d" 
             Visibility="{Binding Visible, Converter={StaticResource BooleanToVisibilityConverter}}"
             Height="90" Width="250"
             d:DataContext="{d:DesignInstance designTime:DesignTimeUpdateViewModel, IsDesignTimeCreatable=True}"
             Background="White">
    <UserControl.RenderTransform>
        <TranslateTransform x:Name="UpdatePopupTransform" X="250" />
    </UserControl.RenderTransform>
    <UserControl.Triggers>
        <!-- This EventTrigger/Storyboard animates the UpdateView so it slides in from the right when it is shown -->
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="UpdatePopupTransform" Storyboard.TargetProperty="(X)" To="0" Duration="0:0:1.25" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </UserControl.Triggers>
    <Border BorderBrush="Black" BorderThickness="1">
        <Grid Margin="4">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding IsInErrorState, Converter={StaticResource InverseBooleanVisibilityConverter}}">A new version of Filtration is available!</TextBlock>
            <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" Visibility="{Binding IsInErrorState, Converter={StaticResource BooleanToVisibilityConverter}}" TextWrapping="Wrap">An error occured while checking for updates</TextBlock>
            <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button  Command="{Binding NextStepCommand}" Width="160" Height="30">
                <TextBlock Text="{Binding NextStepButtonText}" />
            </Button>
                <Button Height="30" Width="50" Margin="10,0,0,0" Command="{Binding HideUpdateWindowCommand}">Cancel</Button>
            </StackPanel>
        </Grid>
    </Border>
</UserControl>
