<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:n="clr-namespace:ScreenToGif.Controls"
                    xmlns:c="clr-namespace:ScreenToGif.Util.Converters"
                    xmlns:s="clr-namespace:System;assembly=mscorlib">

    <c:DoubleToPercentage x:Key="DoubleToPercentageConverter"/>
    <c:BytesToSize x:Key="BytesToSizeConverter"/>

    <ControlTemplate x:Key="Template.Encoding" TargetType="{x:Type n:EncoderListViewItem}">
        <Border x:Name="MainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="6"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                
                <Border Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" x:Name="InternalBorder" Background="{TemplateBinding Icon}" 
                        Margin="1" Visibility="Visible" Effect="{x:Null}" Opacity="{DynamicResource Element.Opacity}"/>

                <n:ExtendedButton Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" x:Name="CancelButton" Padding="2" Icon="{DynamicResource Vector.Close}" ContentWidth="15" ContentHeight="15"
                                  VerticalAlignment="Stretch" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"
                                  Visibility="Hidden" MaxWidth="{Binding Path=Height, RelativeSource={RelativeSource Mode=Self}}" Style="{DynamicResource Style.Button.NoText}">
                    <n:ExtendedButton.ToolTip>
                        <ToolTip x:Name="CancelToolTip" Content="{DynamicResource S.Action.Cancel}" Placement="Left" VerticalOffset="-5"/>
                    </n:ExtendedButton.ToolTip>
                </n:ExtendedButton>

                <Label Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" x:Name="PercentageLabel" Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Percentage}" ContentStringFormat="{}{0:##0.0} %"
                       Foreground="{DynamicResource Element.Foreground.Gray112}" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center"
                       FontFamily="Segoe UI Semilight" BorderThickness="0" MinWidth="50"/>

                <Label Grid.Row="0" Grid.Column="2" Content="{TemplateBinding Text}" HorizontalAlignment="Stretch" Padding="0,1,0,0" Foreground="{DynamicResource Element.Foreground}"/>

                <ProgressBar Grid.Row="1" Grid.Column="2" Value="{TemplateBinding Percentage}" IsIndeterminate="{TemplateBinding IsIndeterminate}"
                             Minimum="0" Maximum="100" Height="4" HorizontalAlignment="Stretch" Orientation="Horizontal" HorizontalContentAlignment="Stretch"/>
            </Grid>
        </Border>

        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsEnabled" Value="True"/>
                </MultiTrigger.Conditions>

                <Setter TargetName="CancelButton" Property="Visibility" Value="Visible"/>
                <Setter TargetName="InternalBorder" Property="Visibility" Value="Collapsed"/>
            </MultiTrigger>

            <Trigger Property="OutputType" Value="Gif">
                <Setter Property="Icon" Value="{DynamicResource Vector.Gif}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Apng">
                <Setter Property="Icon" Value="{DynamicResource Vector.Apng}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Webp">
                <Setter Property="Icon" Value="{DynamicResource Vector.Webp}"/>
            </Trigger>

            <Trigger Property="OutputType" Value="Bmp">
                <Setter Property="Icon" Value="{DynamicResource Vector.Bmp}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Jpeg">
                <Setter Property="Icon" Value="{DynamicResource Vector.Jpg}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Png">
                <Setter Property="Icon" Value="{DynamicResource Vector.Apng}"/>
            </Trigger>
            
            <Trigger Property="OutputType" Value="Avi">
                <Setter Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Mov">
                <Setter Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Mp4">
                <Setter Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Mkv">
                <Setter Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Webm">
                <Setter Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            
            <Trigger Property="OutputType" Value="Psd">
                <Setter Property="Icon" Value="{DynamicResource Vector.Psd}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Stg">
                <Setter Property="Icon" Value="{DynamicResource Vector.Project}"/>
            </Trigger>

            <Trigger Property="IsIndeterminate" Value="True">
                <Setter TargetName="PercentageLabel" Property="Content" Value="~"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="Template.Completed" TargetType="{x:Type n:EncoderListViewItem}">
        <Border x:Name="MainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
                Padding="{TemplateBinding Padding}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <Border Grid.Row="0" Grid.Column="0" x:Name="InternalBorder" Background="{DynamicResource Vector.Ok.Round}"
                        Margin="1" Visibility="Visible" Effect="{x:Null}" Opacity="{DynamicResource Element.Opacity}"/>
                
                <n:ExtendedButton Grid.Row="0" Grid.Column="0" x:Name="CancelButton" Padding="2" Icon="{DynamicResource Vector.Eraser}" ContentWidth="15" ContentHeight="15"
                                  VerticalAlignment="Stretch" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"
                                  Visibility="Hidden" MaxWidth="{Binding Path=Height, RelativeSource={RelativeSource Mode=Self}}" Style="{DynamicResource Style.Button.NoText}">
                    <n:ExtendedButton.ToolTip>
                        <ToolTip x:Name="CancelToolTip" Content="{DynamicResource S.Encoder.Remove}" Placement="Left" VerticalOffset="-5"/>
                    </n:ExtendedButton.ToolTip>
                </n:ExtendedButton>

                <Label Grid.Row="0" Grid.Column="1" x:Name="FileSizeLabel" Content="{TemplateBinding SizeInBytes, Converter={StaticResource BytesToSizeConverter}}" 
                       Foreground="{DynamicResource Element.Foreground.Gray112}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"
                       HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontStyle="Italic" BorderThickness="0" MinWidth="45"/>

                <StackPanel Grid.Column="2"  HorizontalAlignment="Stretch" VerticalAlignment="Center">
                    <WrapPanel Orientation="Horizontal">
                        <TextBlock Text="{DynamicResource S.Encoder.Completed}" Margin="0,0,5,0" Foreground="{DynamicResource Element.Foreground}"/>

                        <TextBlock x:Name="CopiedTextBlock" Visibility="Collapsed" Margin="0,0,5,0">
                            <Run Text="{DynamicResource S.Encoder.Completed.Clipboard}" Foreground="{DynamicResource Element.Foreground}"/>
                        </TextBlock>

                        <TextBlock x:Name="CopyFailedTextBlock" Visibility="Visible" Margin="0,0,5,0">
                            <Hyperlink x:Name="CopyFailedHyperlink" ToolTip="{DynamicResource S.Encoder.Error.Info}">
                                <Run Text="{DynamicResource S.Encoder.Completed.Clipboard.Fail}"/>
                            </Hyperlink>
                        </TextBlock>

                        <TextBlock x:Name="ExecutedTextBlock" Visibility="Collapsed" Margin="0,0,5,0">
                            <Hyperlink x:Name="ExecutedHyperlink" ToolTip="{DynamicResource S.Encoder.Completed.Command.Output}">
                                <Run Text="{DynamicResource S.Encoder.Completed.Command}"/>
                            </Hyperlink>
                        </TextBlock>

                        <TextBlock x:Name="ExecutionFailedTextBlock" Visibility="Visible" Margin="0,0,5,0">
                            <Hyperlink x:Name="ExecutionFailedHyperlink" ToolTip="{DynamicResource S.Encoder.Error.Info}">
                                <Run Text="{DynamicResource S.Encoder.Completed.Command.Fail}"/>
                            </Hyperlink>
                        </TextBlock>
                    </WrapPanel>

                    <StackPanel x:Name="UploadStackPanel" Orientation="Horizontal" Visibility="Collapsed">
                        <TextBlock x:Name="UploadedTextBlock" Visibility="Collapsed" ToolTip="{DynamicResource S.Encoder.Completed.Upload.Delete}">
                            <Hyperlink x:Name="UploadHyperlink">
                                <Run Text="{TemplateBinding UploadLinkDisplay}"/>
                            </Hyperlink>
                        </TextBlock>
                        <TextBlock x:Name="UploadFailedTextBlock" Visibility="Visible">
                            <Hyperlink x:Name="UploadFailedHyperlink" ToolTip="{DynamicResource S.Encoder.Error.Info}">
                                <Run Text="{DynamicResource S.Encoder.Completed.Upload.Fail}"/>
                            </Hyperlink>
                        </TextBlock>
                    </StackPanel>
                </StackPanel>

                <TextBlock Grid.Column="3" x:Name="TimeTextBlock" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TotalTime, StringFormat={}{0:mm}:{0:ss}}"
                           Foreground="{DynamicResource Element.Foreground.Gray112}" VerticalAlignment="Center" Margin="5,3">
                    <TextBlock.ToolTip>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Text="{DynamicResource S.Encoder.Completed.Elapsed}"/>

                            <TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource S.Encoder.Completed.Elapsed.Analysis}"/>
                            <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TimeToAnalyze, StringFormat={}{0:mm}:{0:ss}:{0:fff}}"/>

                            <TextBlock Grid.Row="2" Grid.Column="0" Text="{DynamicResource S.Encoder.Completed.Elapsed.Encoding}"/>
                            <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TimeToEncode, StringFormat={}{0:mm}:{0:ss}:{0:fff}}"/>

                            <TextBlock Grid.Row="3" Grid.Column="0" x:Name="UploadTimeHeaderTextBlock" Text="{DynamicResource S.Encoder.Completed.Elapsed.Upload}"/>
                            <TextBlock Grid.Row="3" Grid.Column="1" x:Name="UploadTimeTextBlock" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TimeToUpload, StringFormat={}{0:mm}:{0:ss}:{0:fff}}"/>

                            <TextBlock Grid.Row="4" Grid.Column="0" x:Name="CopyTimeHeaderTextBlock" Text="{DynamicResource S.Encoder.Completed.Elapsed.Copy}"/>
                            <TextBlock Grid.Row="4" Grid.Column="1" x:Name="CopyTimeTextBlock" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TimeToCopy, StringFormat={}{0:mm}:{0:ss}:{0:fff}}"/>

                            <TextBlock Grid.Row="5" Grid.Column="0" x:Name="ExecuteTimeHeaderTextBlock" Text="{DynamicResource S.Encoder.Completed.Elapsed.Commands}"/>
                            <TextBlock Grid.Row="5" Grid.Column="1" x:Name="ExecuteTimeTextBlock" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TimeToExecute, StringFormat={}{0:mm}:{0:ss}:{0:fff}}"/>
                        </Grid>
                    </TextBlock.ToolTip>
                </TextBlock>

                <n:ExtendedButton Grid.Column="4" x:Name="FileButton" Style="{DynamicResource Style.Button.NoText}" Icon="{DynamicResource Vector.Gif}" 
                                  Padding="2,0" ContentWidth="20" ContentHeight="20" ToolTipService.Placement="Top" ToolTipService.HorizontalOffset="-5">
                    <n:ExtendedButton.ToolTip>
                        <TextBlock Foreground="{DynamicResource Element.Foreground}">
                            <Run Text="{DynamicResource S.Encoder.OpenFile}"/>
                            <LineBreak/>
                            <Run Text="{TemplateBinding OutputFilename}"/>
                        </TextBlock>
                    </n:ExtendedButton.ToolTip>
                </n:ExtendedButton>

                <n:ExtendedButton Grid.Column="5" x:Name="FolderButton" Style="{DynamicResource Style.Button.NoText}" Icon="{DynamicResource Vector.Open}" 
                                  Padding="2,0" ContentWidth="20" ContentHeight="20" ToolTipService.Placement="Top" ToolTipService.HorizontalOffset="-5">
                    <n:ExtendedButton.ToolTip>
                        <TextBlock Foreground="{DynamicResource Element.Foreground}">
                            <Run Text="{DynamicResource S.Encoder.ExploreFolder}"/>
                            <LineBreak/>
                            <Run Text="{TemplateBinding OutputPath}"/>
                        </TextBlock>
                    </n:ExtendedButton.ToolTip>
                </n:ExtendedButton>
            </Grid>

            <Border.ContextMenu>
                <ContextMenu>
                    <n:ExtendedMenuItem x:Name="CopyMenuItem" Header="{DynamicResource S.Editor.Home.Copy}" Icon="{DynamicResource Vector.Copy}"/>
                    <Separator/>
                    <n:ExtendedMenuItem x:Name="CopyImageMenuItem" Header="{DynamicResource S.Encoder.Copy.Image}" Visibility="Collapsed"/>
                    <n:ExtendedMenuItem x:Name="CopyFilenameMenuItem" Header="{DynamicResource S.Encoder.Copy.Filename}"/>
                    <n:ExtendedMenuItem x:Name="CopyFolderMenuItem" Header="{DynamicResource S.Encoder.Copy.Folder}"/>
                    <n:ExtendedMenuItem x:Name="CopyLinkMenuItem" Header="{DynamicResource S.Encoder.Copy.Link}" Visibility="Collapsed"/>
                </ContextMenu>
            </Border.ContextMenu>
        </Border>

        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsEnabled" Value="True"/>
                </MultiTrigger.Conditions>

                <Setter TargetName="CancelButton" Property="Visibility" Value="Visible"/>
                <Setter TargetName="InternalBorder" Property="Visibility" Value="Collapsed"/>
            </MultiTrigger>

            <Trigger Property="OutputType" Value="Gif">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Gif}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Apng">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Apng}"/>
                <Setter TargetName="CopyImageMenuItem" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Webp">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Webp}"/>
            </Trigger>

            <Trigger Property="OutputType" Value="Bmp">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Bmp}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Jpeg">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Jpeg}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Png">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Apng}"/>
            </Trigger>
            
            <Trigger Property="OutputType" Value="Avi">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Mov">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Mp4">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Mkv">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Webm">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Video}"/>
            </Trigger>
            
            <Trigger Property="OutputType" Value="Psd">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Psd}"/>
            </Trigger>
            <Trigger Property="OutputType" Value="Stg">
                <Setter TargetName="FileButton" Property="Icon" Value="{DynamicResource Vector.Project}"/>
            </Trigger>

            <Trigger Property="CopiedToClipboard" Value="True">
                <Setter TargetName="CopiedTextBlock" Property="Visibility" Value="Visible"/>
            </Trigger>

            <Trigger Property="CopyTaskException" Value="{x:Null}">
                <Setter TargetName="CopyFailedTextBlock" Property="Visibility" Value="Collapsed"/>
            </Trigger>

            <Trigger Property="CommandExecuted" Value="True">
                <Setter TargetName="ExecutedTextBlock" Property="Visibility" Value="Visible"/>
            </Trigger>

            <Trigger Property="CommandTaskException" Value="{x:Null}">
                <Setter TargetName="ExecutionFailedTextBlock" Property="Visibility" Value="Collapsed"/>
            </Trigger>

            <Trigger Property="AreMultipleFiles" Value="True">
                <Setter TargetName="FileButton" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            
            <Trigger Property="Uploaded" Value="True">
                <Setter TargetName="UploadedTextBlock" Property="Visibility" Value="Visible"/>
                <Setter TargetName="CopyLinkMenuItem" Property="Visibility" Value="Visible"/>
            </Trigger>

            <Trigger Property="UploadTaskException" Value="{x:Null}">
                <Setter TargetName="UploadFailedTextBlock" Property="Visibility" Value="Collapsed"/>
            </Trigger>

            <Trigger SourceName="UploadedTextBlock" Property="Visibility" Value="Visible">
                <Setter TargetName="UploadStackPanel" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger SourceName="UploadFailedTextBlock" Property="Visibility" Value="Visible">
                <Setter TargetName="UploadStackPanel" Property="Visibility" Value="Visible"/>
            </Trigger>

            <Trigger Property="TotalTime" Value="{x:Static s:TimeSpan.Zero}">
                <Setter TargetName="TimeTextBlock" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="TimeToUpload" Value="{x:Static s:TimeSpan.Zero}">
                <Setter TargetName="UploadTimeHeaderTextBlock" Property="Visibility" Value="Collapsed"/>
                <Setter TargetName="UploadTimeTextBlock" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="TimeToCopy" Value="{x:Static s:TimeSpan.Zero}">
                <Setter TargetName="CopyTimeHeaderTextBlock" Property="Visibility" Value="Collapsed"/>
                <Setter TargetName="CopyTimeTextBlock" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="TimeToExecute" Value="{x:Static s:TimeSpan.Zero}">
                <Setter TargetName="ExecuteTimeHeaderTextBlock" Property="Visibility" Value="Collapsed"/>
                <Setter TargetName="ExecuteTimeTextBlock" Property="Visibility" Value="Collapsed"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="Template.Error" TargetType="{x:Type n:EncoderListViewItem}">
        <Border x:Name="MainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <Border Grid.Row="0" Grid.Column="0" x:Name="InternalBorder" Background="{DynamicResource Vector.Cancel.Round}" 
                        Margin="2" Visibility="Visible" Effect="{x:Null}" Opacity="{DynamicResource Element.Opacity}"/>

                <n:ExtendedButton Grid.Row="0" Grid.Column="0" x:Name="CancelButton" Padding="2" Icon="{DynamicResource Vector.Eraser}" ContentWidth="15" ContentHeight="15" 
                                  VerticalAlignment="Stretch" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"
                                  Visibility="Hidden" MaxWidth="{Binding Path=Height, RelativeSource={RelativeSource Mode=Self}}" Style="{DynamicResource Style.Button.NoText}">
                    <n:ExtendedButton.ToolTip>
                        <ToolTip Content="{DynamicResource S.Encoder.Remove}" Placement="Left" VerticalOffset="-5"/>
                    </n:ExtendedButton.ToolTip>
                </n:ExtendedButton>

                <Label Grid.Row="0" Grid.Column="2" Content="{DynamicResource S.Encoder.Error}" Foreground="{DynamicResource Element.Foreground}" 
                       HorizontalAlignment="Stretch" VerticalAlignment="Center" Padding="0,1,0,0"/>

                <n:ExtendedButton Grid.Column="3" x:Name="DetailsButton" Style="{DynamicResource Style.Button.NoText}" Icon="{DynamicResource Vector.Application}" 
                                  Padding="2,0" ContentWidth="20" ContentHeight="20">
                    <n:ExtendedButton.ToolTip>
                        <ToolTip Content="{DynamicResource S.Encoder.Details}" Placement="Top" HorizontalOffset="-5"/>
                    </n:ExtendedButton.ToolTip>
                </n:ExtendedButton>
            </Grid>
        </Border>

        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsEnabled" Value="True"/>
                </MultiTrigger.Conditions>

                <Setter TargetName="CancelButton" Property="Visibility" Value="Visible"/>
                <Setter TargetName="InternalBorder" Property="Visibility" Value="Collapsed"/>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="Template.Canceled" TargetType="{x:Type n:EncoderListViewItem}">
        <Border x:Name="MainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="6"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <n:ExtendedButton Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" x:Name="CancelButton" Padding="2" Icon="{DynamicResource Vector.Close}" ContentWidth="15" ContentHeight="15"  
                                  VerticalAlignment="Stretch" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"
                                  MaxWidth="{Binding Path=Height, RelativeSource={RelativeSource Mode=Self}}" Style="{DynamicResource Style.Button.NoText}">
                    <n:ExtendedButton.ToolTip>
                        <ToolTip x:Name="CancelToolTip" Content="{DynamicResource S.Encoder.Remove}" Placement="Left" VerticalOffset="-5"/>
                    </n:ExtendedButton.ToolTip>
                </n:ExtendedButton>

                <Label Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" x:Name="PercentageLabel" Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Percentage}" ContentStringFormat="{}{0:##0.0} %" 
                       Foreground="{DynamicResource Element.Foreground.Gray112}" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center"
                       FontFamily="Segoe UI Semilight" BorderThickness="0" MinWidth="45"/>

                <Label Grid.Row="0" Grid.Column="2" Content="{DynamicResource S.Encoder.Canceled}" Foreground="{DynamicResource Element.Foreground}" HorizontalAlignment="Stretch" Padding="0,1,0,0"/>

                <ProgressBar Grid.Row="1" Grid.Column="2" Value="{TemplateBinding Percentage}" Minimum="0" Maximum="100" Height="4" HorizontalAlignment="Stretch" Orientation="Horizontal" HorizontalContentAlignment="Stretch"/>
            </Grid>
        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="Template.File" TargetType="{x:Type n:EncoderListViewItem}">
        <Border x:Name="MainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <Border Grid.Row="0" Grid.Column="0" x:Name="InternalBorder" Background="{DynamicResource Vector.FilePermission}" Margin="1" 
                        Visibility="Visible" Effect="{x:Null}" Opacity="{DynamicResource Element.Opacity}"/>
                
                <n:ExtendedButton Grid.Row="0" Grid.Column="0" x:Name="CancelButton" Padding="2" Icon="{DynamicResource Vector.Eraser}" ContentWidth="15" ContentHeight="15" 
                                  VerticalAlignment="Stretch" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"
                                  Visibility="Hidden" MaxWidth="{Binding Path=Height, RelativeSource={RelativeSource Mode=Self}}" 
                                  Style="{DynamicResource Style.Button.NoText}">
                    <n:ExtendedButton.ToolTip>
                        <ToolTip Content="{DynamicResource S.Encoder.Remove}" Placement="Left" VerticalOffset="-5"/>
                    </n:ExtendedButton.ToolTip>
                </n:ExtendedButton>

                <Label Grid.Row="0" Grid.Column="2" Content="{DynamicResource S.Encoder.DeletedMoved}" Foreground="{DynamicResource Element.Foreground}" 
                       HorizontalAlignment="Stretch" VerticalAlignment="Center" Padding="0,1,0,0"/>
            </Grid>
        </Border>

        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsEnabled" Value="True"/>
                </MultiTrigger.Conditions>

                <Setter TargetName="CancelButton" Property="Visibility" Value="Visible"/>
                <Setter TargetName="InternalBorder" Property="Visibility" Value="Collapsed"/>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--Encoder ListViewItem-->
    <Style TargetType="{x:Type n:EncoderListViewItem}">
        <Setter Property="MinHeight" Value="36"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="BorderThickness" Value="1"/>

        <Style.Triggers>
            <Trigger Property="Status" Value="Processing">
                <Setter Property="Template" Value="{StaticResource Template.Encoding}"/>
            </Trigger>
            <Trigger Property="Status" Value="Completed">
                <Setter Property="Template" Value="{StaticResource Template.Completed}"/>
            </Trigger>
            <Trigger Property="Status" Value="Error">
                <Setter Property="Template" Value="{StaticResource Template.Error}"/>
            </Trigger>
            <Trigger Property="Status" Value="Canceled">
                <Setter Property="Template" Value="{StaticResource Template.Canceled}"/>
            </Trigger>
            <Trigger Property="Status" Value="FileDeletedOrMoved">
                <Setter Property="Template" Value="{StaticResource Template.File}"/>
            </Trigger>

            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsEnabled" Value="True"/>
                </MultiTrigger.Conditions>

                <Setter Property="Background" Value="{DynamicResource Item.MouseOver.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Item.MouseOver.Border}"/>
            </MultiTrigger>

            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="False"/>
                    <Condition Property="IsSelected" Value="True"/>
                </MultiTrigger.Conditions>

                <Setter Property="Background" Value="{DynamicResource Item.SelectedInactive.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Item.SelectedInactive.Border}"/>
            </MultiTrigger>

            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Selector.IsSelectionActive" Value="True"/>
                    <Condition Property="IsSelected" Value="True"/>
                </MultiTrigger.Conditions>

                <Setter Property="Background" Value="{DynamicResource Item.SelectedActive.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Item.SelectedActive.Border}"/>
            </MultiTrigger>

            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value=".7"/>
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>