<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:themes="clr-namespace:HandBrakeWPF.Themes"
             x:Class="HandBrakeWPF.Controls.AlertPanel">

    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="boolTovisibility" />
    </UserControl.Resources>

    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" ZIndex="-1" Background="Black" Opacity="{Binding Source={x:Static themes:ThemeLoader.ThemeOpacity}}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>

        <Border VerticalAlignment="Center" Grid.Row="0" Width="620" CornerRadius="4" BorderBrush="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Background="{DynamicResource Ui.Light}" BorderThickness="1">
            <Grid VerticalAlignment="Center" ZIndex="100" HorizontalAlignment="Stretch" Background="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Image Source="../Views/Images/information64.png" VerticalAlignment="Top" Height="64" Margin="18,10" Grid.Row="0" Grid.Column="0" />

                <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Vertical" Margin="0,20,20,0">
                    <TextBlock SnapsToDevicePixels="True" FontSize="24" FontFamily="Segoe UI"  TextWrapping="WrapWithOverflow" 
                               Text="{Binding Message, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" />

                    <TextBlock SnapsToDevicePixels="True" VerticalAlignment="Top" FontSize="12"  Margin="0,5" HorizontalAlignment="Left" 
                               Text="{Binding SubMessage, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" TextWrapping="WrapWithOverflow" />
                </StackPanel>

                <Button Content="{Binding ActionText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Margin="0,10,15,15" Grid.Row="2" Grid.Column="1"
                        x:Name="StatusActionButton" Click="StatusActionButton_OnClick" Padding="8,2" HorizontalAlignment="Right" IsDefault="True"
                        Visibility="{Binding IsActionButtonVisible, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Converter={StaticResource boolTovisibility}}" />

            </Grid>
        </Border>
    </Grid>
</UserControl>
