<Window
    x:ClassModifier="internal"
    x:Class="PixiEditor.Views.MainWindow"
    MinHeight="500"
    MinWidth="700"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:gif="http://wpfanimatedgif.codeplex.com" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:PixiEditor"
    xmlns:tools="clr-namespace:PixiEditor.ViewModels.SubViewModels.Tools.Tools"
    xmlns:vm="clr-namespace:PixiEditor.ViewModels"
    xmlns:doc="clr-namespace:PixiEditor.ViewModels.SubViewModels.Document"
    xmlns:dataHolders="clr-namespace:PixiEditor.Models.DataHolders"
    xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
    xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
    xmlns:ui="clr-namespace:PixiEditor.Helpers.UI"
    xmlns:avalondock="https://github.com/Dirkster99/AvalonDock"
    xmlns:colorpicker="clr-namespace:ColorPicker;assembly=ColorPicker"
    xmlns:usercontrols="clr-namespace:PixiEditor.Views.UserControls"
    xmlns:behaviours="clr-namespace:PixiEditor.Helpers.Behaviours"
    xmlns:avalonDockTheme="clr-namespace:PixiEditor.Styles.AvalonDock"
    xmlns:layerUserControls="clr-namespace:PixiEditor.Views.UserControls.Layers"
    xmlns:cmds="clr-namespace:PixiEditor.Models.Commands.XAML"
    xmlns:commandSearch="clr-namespace:PixiEditor.Views.UserControls.CommandSearch"
    xmlns:palettes="clr-namespace:PixiEditor.Views.UserControls.Palettes"
    xmlns:views="clr-namespace:PixiEditor.Views"
    xmlns:system="clr-namespace:System;assembly=System.Runtime"
    xmlns:helpers="clr-namespace:PixiEditor.Helpers"
    xmlns:ui1="clr-namespace:PixiEditor.Extensions.UI;assembly=PixiEditor.Extensions"
    KeyDown="MainWindow_OnKeyDown"
    d:DataContext="{d:DesignInstance Type=vm:ViewModelMain}"
    mc:Ignorable="d"
    WindowStyle="None"
    Initialized="MainWindow_Initialized"
    Title="PixiEditor"
    Name="mainWindow"
    Height="1000"
    Width="1600"
    Background="{StaticResource MainColor}"
    WindowStartupLocation="CenterScreen"
    WindowState="Maximized"
    FlowDirection="{helpers:Localization FlowDirection}">
    <WindowChrome.WindowChrome>
        <WindowChrome
            CaptionHeight="35"
            GlassFrameThickness="0.1"
            x:Name="windowsChrome" />
    </WindowChrome.WindowChrome>

    <Window.Resources>
        <ResourceDictionary>
            <BooleanToVisibilityConverter
                x:Key="BoolToVisibilityConverter" />
            <converters:BoolToIntConverter
                x:Key="BoolToIntConverter" />
            <converters:NotNullToBoolConverter
                x:Key="NotNullToBoolConverter" />
            <converters:DoubleToIntConverter
                x:Key="DoubleToIntConverter" />
            <converters:GenericColorToMediaColorConverter
                x:Key="BackendColorToMediaColorConverter" />
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary
                    Source="pack://application:,,,/ColorPicker;component/Styles/DefaultColorPickerStyle.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Window.CommandBindings>
        <CommandBinding
            Command="{x:Static SystemCommands.CloseWindowCommand}"
            CanExecute="CommandBinding_CanExecute"
            Executed="CommandBinding_Executed_Close" />
        <CommandBinding
            Command="{x:Static SystemCommands.MaximizeWindowCommand}"
            CanExecute="CommandBinding_CanExecute"
            Executed="CommandBinding_Executed_Maximize" />
        <CommandBinding
            Command="{x:Static SystemCommands.MinimizeWindowCommand}"
            CanExecute="CommandBinding_CanExecute"
            Executed="CommandBinding_Executed_Minimize" />
        <CommandBinding
            Command="{x:Static SystemCommands.RestoreWindowCommand}"
            CanExecute="CommandBinding_CanExecute"
            Executed="CommandBinding_Executed_Restore" />
    </Window.CommandBindings>

    <b:Interaction.Triggers>
        <b:EventTrigger
            EventName="ContentRendered">
            <b:InvokeCommandAction
                Command="{Binding OnStartupCommand}" />
        </b:EventTrigger>
        <b:EventTrigger
            EventName="Closing">
            <b:InvokeCommandAction
                Command="{Binding CloseWindowCommand}"
                PassEventArgsToCommand="True" />
        </b:EventTrigger>
    </b:Interaction.Triggers>
    <Grid>
        <Grid
            Name="mainGrid"
            Margin="5"
            KeyboardNavigation.DirectionalNavigation="None"
            KeyboardNavigation.TabNavigation="None"
            Focusable="True">
            <Grid.ColumnDefinitions>
                <ColumnDefinition
                    Width="45" />
                <ColumnDefinition
                    Width="1*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition
                    Height="30" />
                <RowDefinition
                    Height="40" />
                <RowDefinition
                    Height="1*" />
                <RowDefinition
                    Height="30" />
            </Grid.RowDefinitions>
            <b:Interaction.Behaviors>
                <behaviours:ClearFocusOnClickBehavior />
            </b:Interaction.Behaviors>
            <DockPanel
                Grid.Row="0"
                Grid.Column="0"
                Grid.ColumnSpan="3"
                Background="{StaticResource MainColor}">
                <Image
                    DockPanel.Dock="Left"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    Source="/Images/PixiEditorLogo.png"
                    Width="20"
                    Height="20"
                    Margin="5,2,0,0" />
                <cmds:Menu
                    WindowChrome.IsHitTestVisibleInChrome="True"
                    Margin="10, 0, 0, 0"
                    DockPanel.Dock="Left"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    Background="Transparent"
                    IsMainMenu="True">
                    <Menu.Resources>
                        <Style
                            TargetType="{x:Type MenuItem}"
                            BasedOn="{StaticResource menuItemStyle}" />
                    </Menu.Resources>
                    <MenuItem
                        ui1:Translator.Key="FILE"
                        Focusable="False">
                        <MenuItem
                            ui1:Translator.Key="NEW_FILE"
                            cmds:Menu.Command="PixiEditor.File.New" />
                        <MenuItem
                            ui1:Translator.Key="OPEN"
                            cmds:Menu.Command="PixiEditor.File.Open" />
                        <MenuItem
                            ui1:Translator.Key="RECENT"
                            ItemsSource="{Binding FileSubViewModel.RecentlyOpened}"
                            x:Name="recentItemMenu"
                            IsEnabled="{Binding FileSubViewModel.HasRecent}">
                            <MenuItem.ItemContainerStyle>
                                <Style
                                    TargetType="MenuItem"
                                    BasedOn="{StaticResource PixiEditorDockThemeMenuItemStyle}">
                                    <Setter
                                        Property="Command"
                                        Value="{cmds:Command PixiEditor.File.OpenRecent, UseProvided=True}" />
                                    <Setter
                                        Property="CommandParameter"
                                        Value="{Binding FilePath}" />
                                </Style>
                            </MenuItem.ItemContainerStyle>
                            <MenuItem.ItemTemplate>
                                <DataTemplate
                                    DataType="{x:Type dataHolders:RecentlyOpenedDocument}">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        
                                        <TextBlock Text="{Binding FilePath}"/>
                                        <TextBlock Grid.Column="1" Margin="20,0,0,0" VerticalAlignment="Center">
                                            <Hyperlink Foreground="#FFF" FontFamily="{StaticResource Feather}"
                                                       Command="{cmds:Command Name=PixiEditor.File.RemoveRecent, UseProvided=True}"
                                                       CommandParameter="{Binding FilePath}"></Hyperlink>
                                        </TextBlock>
                                    </Grid>
                                </DataTemplate>
                            </MenuItem.ItemTemplate>
                        </MenuItem>
                        <MenuItem
                            Focusable="False"
                            ui1:Translator.Key="SAVE_PIXI"
                            cmds:Menu.Command="PixiEditor.File.Save" />
                        <MenuItem
                            ui1:Translator.Key="SAVE_AS_PIXI"
                            cmds:Menu.Command="PixiEditor.File.SaveAsNew" />
                        <MenuItem
                            ui1:Translator.Key="EXPORT_IMG"
                            cmds:Menu.Command="PixiEditor.File.Export" />
                        <Separator />
                        <MenuItem
                            ui1:Translator.Key="EXIT"
                            Command="{x:Static SystemCommands.CloseWindowCommand}">
                            <MenuItem.Icon>
                                <TextBlock Text="&#xE106;" FontFamily="{DynamicResource NativeIconFont}" FontSize="20"/>
                            </MenuItem.Icon>
                        </MenuItem>
                    </MenuItem>
                    <MenuItem
                        Focusable="False"
                        ui1:Translator.Key="EDIT">
                        <MenuItem
                            ui1:Translator.Key="UNDO"
                            cmds:Menu.Command="PixiEditor.Undo.Undo" />
                        <MenuItem
                            ui1:Translator.Key="REDO"
                            cmds:Menu.Command="PixiEditor.Undo.Redo" />
                        <Separator />
                        <MenuItem
                            ui1:Translator.Key="CUT"
                            cmds:Menu.Command="PixiEditor.Clipboard.Cut" />
                        <MenuItem
                            ui1:Translator.Key="COPY"
                            cmds:Menu.Command="PixiEditor.Clipboard.Copy" />
                        <MenuItem
                            ui1:Translator.Key="PASTE"
                            cmds:Menu.Command="PixiEditor.Clipboard.Paste" />
                        <MenuItem
                            ui1:Translator.Key="DUPLICATE"
                            cmds:Menu.Command="PixiEditor.Layer.DuplicateSelectedLayer" />
                        <Separator />
                        <MenuItem
                            ui1:Translator.Key="DELETE_SELECTED_PIXELS"
                            cmds:Menu.Command="PixiEditor.Document.DeletePixels" />
                        <Separator />
                        <MenuItem
                            ui1:Translator.Key="SETTINGS"
                            cmds:Menu.Command="PixiEditor.Window.OpenSettingsWindow" />
                    </MenuItem>
                    <MenuItem
                        Focusable="False"
                        ui1:Translator.Key="SELECT">
                        <MenuItem
                            ui1:Translator.Key="SELECT_ALL"
                            cmds:Menu.Command="PixiEditor.Selection.SelectAll" />
                        <MenuItem
                            ui1:Translator.Key="DESELECT"
                            cmds:Menu.Command="PixiEditor.Selection.Clear" />
                        <MenuItem
                            ui1:Translator.Key="INVERT"
                            cmds:Menu.Command="PixiEditor.Selection.InvertSelection" />
                        <MenuItem
                            ui1:Translator.Key="CROP_TO_SELECTION"
                            cmds:Menu.Command="PixiEditor.Selection.CropToSelection" />
                        <Separator/>
                        <MenuItem ui1:Translator.Key="SELECTION_TO_MASK">
                            <MenuItem
                                ui1:Translator.Key="TO_NEW_MASK"
                                cmds:Menu.Command="PixiEditor.Selection.NewToMask" />
                            <MenuItem
                                ui1:Translator.Key="ADD_TO_MASK"
                                cmds:Menu.Command="PixiEditor.Selection.AddToMask" />
                            <MenuItem
                                ui1:Translator.Key="SUBTRACT_FROM_MASK"
                                cmds:Menu.Command="PixiEditor.Selection.SubtractFromMask" />
                            <MenuItem
                                ui1:Translator.Key="INTERSECT_WITH_MASK"
                                cmds:Menu.Command="PixiEditor.Selection.IntersectSelectionMask" />
                        </MenuItem>
                    </MenuItem>
                    <MenuItem
                        Focusable="False"
                        ui1:Translator.Key="IMAGE">
                        <MenuItem
                            ui1:Translator.Key="RESIZE_IMAGE"
                            cmds:Menu.Command="PixiEditor.Document.ResizeDocument" />
                        <MenuItem
                            ui1:Translator.Key="RESIZE_CANVAS"
                            cmds:Menu.Command="PixiEditor.Document.ResizeCanvas" />
                        <Separator />
                        <MenuItem
                            ui1:Translator.Key="CLIP_CANVAS"
                            cmds:Menu.Command="PixiEditor.Document.ClipCanvas" />
                        <MenuItem
                            ui1:Translator.Key="CENTER_CONTENT"
                            cmds:Menu.Command="PixiEditor.Document.CenterContent" />
                        <Separator />
                        <MenuItem
                            IsCheckable="True"
                            IsEnabled="{Binding DocumentManagerSubViewModel.ActiveDocument, Source={vm:MainVM}, Converter={converters:NotNullToBoolConverter}}"
                            IsChecked="{Binding DocumentManagerSubViewModel.ActiveDocument.HorizontalSymmetryAxisEnabledBindable}"
                            ui1:Translator.Key="HORIZONTAL_LINE_SYMMETRY">
                            <MenuItem.Icon>
                                <Image Source="../Images/SymmetryHorizontal.png"
                                       Width="{x:Static cmds:Menu.IconDimensions}" Height="{x:Static cmds:Menu.IconDimensions}"/>
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem
                            IsCheckable="True"
                            IsEnabled="{Binding DocumentManagerSubViewModel.ActiveDocument, Source={vm:MainVM}, Converter={converters:NotNullToBoolConverter}}"
                            IsChecked="{Binding DocumentManagerSubViewModel.ActiveDocument.VerticalSymmetryAxisEnabledBindable}"
                            ui1:Translator.Key="VERTICAL_LINE_SYMMETRY">
                            <MenuItem.Icon>
                                <Image Source="../Images/SymmetryVertical.png"
                                       Width="{x:Static cmds:Menu.IconDimensions}" Height="{x:Static cmds:Menu.IconDimensions}"/>
                            </MenuItem.Icon>
                        </MenuItem>
                        <Separator/>
                        <MenuItem ui1:Translator.Key="ROTATION">
                            <MenuItem ui1:Translator.Key="ROT_IMG_90_D" cmds:Menu.Command="PixiEditor.Document.Rotate90Deg"/>
                            <MenuItem ui1:Translator.Key="ROT_IMG_180_D" cmds:Menu.Command="PixiEditor.Document.Rotate180Deg"/>
                            <MenuItem ui1:Translator.Key="ROT_IMG_-90_D" cmds:Menu.Command="PixiEditor.Document.Rotate270Deg"/>
                            
                            <Separator/>
                            <MenuItem ui1:Translator.Key="ROT_LAYERS_90_D" cmds:Menu.Command="PixiEditor.Document.Rotate90DegLayers"/>
                            <MenuItem ui1:Translator.Key="ROT_LAYERS_180_D" cmds:Menu.Command="PixiEditor.Document.Rotate180DegLayers"/>
                            <MenuItem ui1:Translator.Key="ROT_LAYERS_-90_D" cmds:Menu.Command="PixiEditor.Document.Rotate270DegLayers"/>
                        </MenuItem>
                        <MenuItem ui1:Translator.Key="FLIP">
                            <MenuItem ui1:Translator.Key="FLIP_IMG_HORIZONTALLY" cmds:Menu.Command="PixiEditor.Document.FlipImageHorizontal"/>
                            <MenuItem ui1:Translator.Key="FLIP_IMG_VERTICALLY" cmds:Menu.Command="PixiEditor.Document.FlipImageVertical"/>
                            <MenuItem ui1:Translator.Key="FLIP_LAYERS_HORIZONTALLY" cmds:Menu.Command="PixiEditor.Document.FlipLayersHorizontal"/>
                            <MenuItem ui1:Translator.Key="FLIP_LAYERS_VERTICALLY" cmds:Menu.Command="PixiEditor.Document.FlipLayersVertical"/>
                        </MenuItem>
                    </MenuItem>
                    <MenuItem
                        Focusable="False"
                        ui1:Translator.Key="VIEW">
                        <MenuItem
                            ui1:Translator.Key="NEW_WINDOW_FOR_IMG"
                            cmds:Menu.Command="PixiEditor.Window.CreateNewViewport" />
                        <Separator/>
                        <MenuItem
                            ui1:Translator.Key="OPEN_STARTUP_WINDOW"
                            ToolTip="Hello there!"
                            cmds:Menu.Command="PixiEditor.Window.OpenStartupWindow" />
                        <MenuItem
                            ui1:Translator.Key="OPEN_NAVIGATION_WINDOW"
                            cmds:Menu.Command="PixiEditor.Window.OpenNavigationWindow" />
                        <MenuItem
                            ui1:Translator.Key="OPEN_SHORTCUT_WINDOW"
                            cmds:Menu.Command="PixiEditor.Window.OpenShortcutWindow" />
                        <MenuItem
                            ui1:Translator.Key="OPEN_PALETTE_BROWSER"
                            cmds:Menu.Command="PixiEditor.Window.OpenPalettesBrowserWindow" />
                        <Separator/>
                        <MenuItem
                            ui1:Translator.Key="TOGGLE_GRIDLINES"
                            IsChecked="{Binding ViewportSubViewModel.GridLinesEnabled, Mode=TwoWay}"
                            IsCheckable="True"
                            InputGestureText="{cmds:ShortcutBinding PixiEditor.View.ToggleGrid}">
                            <MenuItem.Icon>
                                <Image Source="../Images/Commands/PixiEditor/View/ToggleGrid.png"
                                       Width="{x:Static cmds:Menu.IconDimensions}" Height="{x:Static cmds:Menu.IconDimensions}"/>
                            </MenuItem.Icon>
                        </MenuItem>
                    </MenuItem>
                    <MenuItem
                        Focusable="False"
                        ui1:Translator.Key="HELP">
                        <MenuItem
                            ui1:Translator.Key="DOCUMENTATION"
                            cmds:Menu.Command="PixiEditor.Links.OpenDocumentation" />
                        <MenuItem
                            ui1:Translator.Key="WEBSITE"
                            cmds:Menu.Command="PixiEditor.Links.OpenWebsite" />
                        <MenuItem
                            ui1:Translator.Key="REPOSITORY"
                            cmds:Menu.Command="PixiEditor.Links.OpenRepository" />
                        <Separator />
                        <MenuItem
                            ui1:Translator.Key="LICENSE"
                            cmds:Menu.Command="PixiEditor.Links.OpenLicense" />
                        <MenuItem
                            ui1:Translator.Key="THIRD_PARTY_LICENSES"
                            cmds:Menu.Command="PixiEditor.Links.OpenOtherLicenses" />
                        <Separator/>
                        <MenuItem
                            ui1:Translator.Key="ABOUT"
                            cmds:Menu.Command="PixiEditor.Window.OpenAboutWindow" />
                    </MenuItem>
                    <MenuItem
                        ui1:Translator.Key="DEBUG"
                        Visibility="{Binding DebugSubViewModel.UseDebug, Converter={StaticResource BoolToVisibilityConverter}}">
                        <MenuItem
                            ui1:Translator.Key="OPEN_COMMAND_DEBUG_WINDOW"
                            cmds:Menu.Command="PixiEditor.Debug.OpenCommandDebugWindow"/>
                        <MenuItem
                            ui1:Translator.Key="OPEN_LOCALIZATION_DEBUG_WINDOW"
                            cmds:Menu.Command="PixiEditor.Debug.OpenLocalizationDebugWindow"/>
                        <Separator/>
                        <MenuItem
                            ui1:Translator.Key="OPEN_LOCAL_APPDATA_DIR"
                            cmds:Menu.Command="PixiEditor.Debug.OpenLocalAppDataDirectory" />
                        <MenuItem
                            ui1:Translator.Key="OPEN_ROAMING_APPDATA_DIR"
                            cmds:Menu.Command="PixiEditor.Debug.OpenRoamingAppDataDirectory" />
                        <MenuItem
                            ui1:Translator.Key="OPEN_TEMP_DIR"
                            cmds:Menu.Command="PixiEditor.Debug.OpenTempDirectory" />
                        <MenuItem
                            ui1:Translator.Key="OPEN_INSTALLATION_DIR"
                            cmds:Menu.Command="PixiEditor.Debug.OpenInstallDirectory" />
                        <MenuItem
                            ui1:Translator.Key="OPEN_CRASH_REPORTS_DIR"
                            cmds:Menu.Command="PixiEditor.Debug.OpenCrashReportsDirectory" />
                        <Separator />
                        <MenuItem
                            ui1:Translator.Key="CRASH"
                            cmds:Menu.Command="PixiEditor.Debug.Crash" />
                        <MenuItem
                            ui1:Translator.Key="DELETE">
                            <MenuItem
                                ui1:Translator.Key="USER_PREFS"
                                cmds:Menu.Command="PixiEditor.Debug.DeleteUserPreferences" />
                            <MenuItem
                                ui1:Translator.Key="SHORTCUT_FILE"
                                cmds:Menu.Command="PixiEditor.Debug.DeleteShortcutFile" />
                            <MenuItem
                                ui1:Translator.Key="EDITOR_DATA"
                                cmds:Menu.Command="PixiEditor.Debug.DeleteEditorData" />
                            <Separator/>
                            <MenuItem
                                ui1:Translator.Key="CLEAR_RECENT_DOCUMENTS"
                                cmds:Menu.Command="PixiEditor.Debug.ClearRecentDocument"/>
                        </MenuItem>
                    </MenuItem>
                </cmds:Menu>
                <Border Width="200" Height="25" 
                        Background="{StaticResource DarkerAccentColor}"
                        CornerRadius="5" BorderThickness="1"
                        Margin="10,-6,0,0"
                        WindowChrome.IsHitTestVisibleInChrome="True"
                        Cursor="IBeam">
                    <Border.Style>
                        <Style TargetType="Border">
                            <Style.Triggers>
                                <Trigger Property="IsMouseOver" Value="False">
                                    <Setter Property="BorderBrush" Value="{StaticResource BrighterAccentColor}"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="BorderBrush" Value="{StaticResource AlmostLightModeAccentColor}"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Border.Style>
                    <b:Interaction.Triggers>
                        <b:EventTrigger
                            EventName="MouseDown">
                            <b:InvokeCommandAction
                                Command="{cmds:Command PixiEditor.Search.Toggle}"/>
                        </b:EventTrigger>
                    </b:Interaction.Triggers>
                    <Grid Margin="5,0" VerticalAlignment="Center">
                        <TextBlock Foreground="White" ui1:Translator.Key="SEARCH"/>
                        <TextBlock Text="{cmds:ShortcutBinding PixiEditor.Search.Toggle}"
                                   HorizontalAlignment="Right"
                                   Foreground="White"/>
                    </Grid>
                </Border>
                <StackPanel
                    DockPanel.Dock="Right"
                    VerticalAlignment="Top"
                    Orientation="Horizontal"
                    Margin="0,-5,-5,0"
                    HorizontalAlignment="Right"
                    WindowChrome.IsHitTestVisibleInChrome="True">
                    <Border BorderThickness="1" BorderBrush="{StaticResource PixiRed}"
                            Padding="5 0" CornerRadius="5" Height="25"
                            Visibility="{Binding Path=AdditionalContentSubViewModel.IsSupporterPackAvailable,
                           Converter={converters:BoolToVisibilityConverter}}">
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"
                                   ui1:Translator.Key="PSP:AWESOME_SUPPORTER" />
                    </Border>
                    <Button
                        Style="{StaticResource MinimizeButtonStyle}"
                        WindowChrome.IsHitTestVisibleInChrome="True"
                        ui1:Translator.TooltipKey="MINIMIZE"
                        Command="{x:Static SystemCommands.MinimizeWindowCommand}" />
                    <Button
                        x:Name="RestoreButton"
                        Visibility="Visible"
                        Style="{StaticResource RestoreButtonStyle}"
                        Command="{x:Static SystemCommands.RestoreWindowCommand}"
                        WindowChrome.IsHitTestVisibleInChrome="True"
                        ui1:Translator.TooltipKey="RESTORE" />
                    <Button
                        x:Name="MaximizeButton"
                        Visibility="Collapsed"
                        Style="{StaticResource MaximizeButtonStyle}"
                        Command="{x:Static SystemCommands.MaximizeWindowCommand}"
                        WindowChrome.IsHitTestVisibleInChrome="True"
                        ui1:Translator.TooltipKey="MAXIMIZE" />
                    <Button
                        Style="{StaticResource CloseButtonStyle}"
                        WindowChrome.IsHitTestVisibleInChrome="True"
                        ui1:Translator.TooltipKey="CLOSE"
                        Command="{x:Static SystemCommands.CloseWindowCommand}" />
                </StackPanel>
            </DockPanel>
            <StackPanel
                Background="{StaticResource MainColor}"
                Orientation="Horizontal"
                Grid.ColumnSpan="3"
                Grid.Column="0"
                Grid.Row="1">
                <Button
                    Margin="1,0,0,0"
                    Command="{cmds:Command PixiEditor.Undo.Undo}"
                    ui1:Translator.TooltipKey="UNDO"
                    Style="{StaticResource ToolSettingsGlyphButton}" 
					Content="&#xE7A7;"/>
                <Button 
				Command="{cmds:Command PixiEditor.Undo.Redo}" 
				ui1:Translator.TooltipKey="REDO"
                Style="{StaticResource ToolSettingsGlyphButton}" 
				Content="&#xE7A6;"/>
                <ToggleButton 
				Width="30" 
				BorderThickness="0"
				ui1:Translator.TooltipKey="PEN_MODE"
				Focusable="False"
                IsChecked="{Binding StylusSubViewModel.IsPenModeEnabled}">
                    <ToggleButton.Style>
                        <Style TargetType="ToggleButton">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="ToggleButton">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" 
                                            Background="{TemplateBinding Background}" Focusable="False">
                                            <ContentPresenter HorizontalAlignment="Center"
                                              VerticalAlignment="Center" Focusable="False"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Style.Triggers>
                                <Trigger Property="IsChecked" Value="False">
                                    <Setter Property="Background" Value="Transparent"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="#404040"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Background" Value="#707070"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </ToggleButton.Style>
                    <Image Height="20" Source="../Images/penMode.png"/>
                </ToggleButton>
                <Grid Margin="5,5,10,5" Background="{StaticResource BrighterAccentColor}" Width="5"/>
                <Label Style="{StaticResource BaseLabel}" FontSize="12"
                   VerticalAlignment="Center" ui1:Translator.Key="{Binding ToolsSubViewModel.ActiveTool.DisplayName.Key}"
                   ui1:Translator.TooltipLocalizedString="{Binding ToolsSubViewModel.ActiveTool.ActionDisplay}"
                   />
                <ItemsControl ItemsSource="{Binding ToolsSubViewModel.ActiveTool.Toolbar.Settings}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal" Margin="10, 0, 0, 0" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="10,0,10,0">
                                <Label
                                Visibility="{Binding HasLabel, Converter={StaticResource BoolToVisibilityConverter}}"
                                Foreground="White" ui1:Translator.Key="{Binding Label.Key}" />
                                <ContentControl Content="{Binding SettingControl}" />
                            </StackPanel>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </StackPanel>

            <Grid Grid.Column="1" Grid.Row="2" Background="#303030" >
                <Grid AllowDrop="True" Drop="MainWindow_Drop" DragEnter="MainWindow_DragEnter" DragLeave="MainWindow_DragLeave">
                    <DockingManager 
                        ActiveContent="{Binding WindowSubViewModel.ActiveWindow, Mode=TwoWay}"
                        DocumentsSource="{Binding WindowSubViewModel.Viewports}">
                        <DockingManager.Theme>
                            <avalonDockTheme:PixiEditorDockTheme />
                        </DockingManager.Theme>

                        <avalondock:DockingManager.LayoutItemContainerStyleSelector>
                            <ui:PanelsStyleSelector>
                                <ui:PanelsStyleSelector.DocumentTabStyle>
                                    <Style TargetType="{x:Type avalondock:LayoutItem}">
                                        <Setter Property="Title">
                                            <Setter.Value>
                                                <MultiBinding Converter="{converters:ConcatStringsConverter}" ConverterParameter=" ">
                                                    <MultiBinding.Bindings>
                                                        <Binding Path="Model.Document.FileName"/>
                                                        <Binding Path="Model.Document.AllChangesSaved" Converter="{converters:BoolToAsteriskConverter}"/>
                                                        <Binding Path="Model.Index"/>
                                                    </MultiBinding.Bindings>
                                                </MultiBinding>
                                            </Setter.Value>
                                        </Setter>
                                        <Setter Property="CloseCommand" Value="{Binding Model.RequestCloseCommand}" />
                                    </Style>
                                </ui:PanelsStyleSelector.DocumentTabStyle>
                            </ui:PanelsStyleSelector>
                        </avalondock:DockingManager.LayoutItemContainerStyleSelector>
                        <DockingManager.LayoutItemTemplateSelector>
                            <ui:DocumentsTemplateSelector>
                                <ui:DocumentsTemplateSelector.DocumentsViewTemplate>
                                    <DataTemplate DataType="{x:Type vm:ViewportWindowViewModel}">
                                        <usercontrols:Viewport
                                            CenterViewportTrigger="{Binding CenterViewportTrigger}"
                                            ZoomViewportTrigger="{Binding ZoomViewportTrigger}"
                                            MouseDownCommand="{Binding ElementName=mainWindow, Path=DataContext.IoSubViewModel.MouseDownCommand}"
                                            MouseMoveCommand="{Binding ElementName=mainWindow, Path=DataContext.IoSubViewModel.MouseMoveCommand}"
                                            MouseUpCommand="{Binding ElementName=mainWindow, Path=DataContext.IoSubViewModel.MouseUpCommand}"
                                            MiddleMouseClickedCommand="{Binding IoSubViewModel.PreviewMouseMiddleButtonCommand, Source={vm:MainVM}}"
                                            Cursor="{Binding ToolsSubViewModel.ToolCursor, Source={vm:MainVM}}"
                                            GridLinesVisible="{Binding ViewportSubViewModel.GridLinesEnabled, Source={vm:MainVM}}"
                                            ZoomMode="{Binding ToolsSubViewModel.ActiveTool, Source={vm:MainVM}, Converter={converters:ActiveToolToZoomModeConverter}}"
                                            ZoomOutOnClick="{Binding ToolsSubViewModel.ZoomTool.ZoomOutOnClick, Source={vm:MainVM}}"
                                            UseTouchGestures="{Binding StylusSubViewModel.UseTouchGestures, Source={vm:MainVM}}"
                                            StylusButtonDownCommand="{cmds:Command PixiEditor.Stylus.StylusDown, UseProvided=True}"
                                            StylusButtonUpCommand="{cmds:Command PixiEditor.Stylus.StylusUp, UseProvided=True}"
                                            StylusGestureCommand="{cmds:Command PixiEditor.Stylus.StylusSystemGesture, UseProvided=True}"
                                            StylusOutOfRangeCommand="{cmds:Command PixiEditor.Stylus.StylusOutOfRange, UseProvided=True}"
                                            FlipX="{Binding FlipX, Mode=TwoWay}"
                                            FlipY="{Binding FlipY, Mode=TwoWay}"
                                            ContextMenuOpening="Viewport_OnContextMenuOpening"
                                            Stylus.IsTapFeedbackEnabled="False" 
                                            Stylus.IsTouchFeedbackEnabled="False"
                                            Document="{Binding Document}">
                                            <usercontrols:Viewport.ContextMenu>
                                                <ContextMenu DataContext="{Binding PlacementTarget.Document, RelativeSource={RelativeSource Self}}">
                                                    <ContextMenu.Template>
                                                        <ControlTemplate>
                                                            <Border Background="{StaticResource AccentColor}" BorderBrush="Black" BorderThickness="1" CornerRadius="5">
                                                                <Grid Height="235">
                                                                    <Grid.ColumnDefinitions>
                                                                        <ColumnDefinition Width="{Binding Palette, Converter={converters:PaletteItemsToWidthConverter}}"/>
                                                                        <ColumnDefinition />
                                                                    </Grid.ColumnDefinitions>
                                                                    <Border Grid.Column="1" BorderThickness="0 0 1 0" BorderBrush="Black">
                                                                        <StackPanel Orientation="Vertical" Grid.Column="0">
                                                                            <MenuItem
																		ui1:Translator.Key="SELECT_ALL"
																		cmds:ContextMenu.Command="PixiEditor.Selection.SelectAll" />
                                                                            <MenuItem
                                                                                ui1:Translator.Key="DESELECT"
																		cmds:ContextMenu.Command="PixiEditor.Selection.Clear" />
                                                                            <Separator />
                                                                            <MenuItem
                                                                                ui1:Translator.Key="CUT"
																		cmds:ContextMenu.Command="PixiEditor.Clipboard.Cut" />
                                                                            <MenuItem
                                                                                ui1:Translator.Key="COPY"
																		cmds:ContextMenu.Command="PixiEditor.Clipboard.Copy" />
                                                                            <MenuItem
                                                                                ui1:Translator.Key="PASTE"
																		cmds:ContextMenu.Command="PixiEditor.Clipboard.Paste" />
                                                                            <Separator />
                                                                            <MenuItem ui1:Translator.Key="FLIP_LAYERS_HORIZONTALLY" cmds:Menu.Command="PixiEditor.Document.FlipLayersHorizontal"/>
                                                                            <MenuItem ui1:Translator.Key="FLIP_LAYERS_VERTICALLY" cmds:Menu.Command="PixiEditor.Document.FlipLayersVertical"/>
                                                                            <Separator />
                                                                            <MenuItem ui1:Translator.Key="ROT_LAYERS_90_D" cmds:Menu.Command="PixiEditor.Document.Rotate90DegLayers"/>
                                                                            <MenuItem ui1:Translator.Key="ROT_LAYERS_180_D" cmds:Menu.Command="PixiEditor.Document.Rotate180DegLayers"/>
                                                                            <MenuItem ui1:Translator.Key="ROT_LAYERS_-90_D" cmds:Menu.Command="PixiEditor.Document.Rotate270DegLayers"/>
                                                                        </StackPanel>
                                                                    </Border>
                                                                    <ScrollViewer Margin="5" Grid.Column="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                                                                        <ItemsControl ItemsSource="{Binding Palette}" AlternationCount="9999">
                                                                            <ItemsControl.ItemsPanel>
                                                                                <ItemsPanelTemplate>
                                                                                    <WrapPanel Orientation="Horizontal"
                                  HorizontalAlignment="Left" VerticalAlignment="Top"/>
                                                                                </ItemsPanelTemplate>
                                                                            </ItemsControl.ItemsPanel>
                                                                            <ItemsControl.ItemTemplate>
                                                                                <DataTemplate>
                                                                                    <palettes:PaletteColorControl Cursor="Hand" CornerRadius="0"
                                                                                        ui1:Translator.TooltipKey="CLICK_SELECT_PRIMARY"
                                                                                        Width="22" Height="22" Color="{Binding}">
                                                                                        <b:Interaction.Triggers>
                                                                                            <b:EventTrigger EventName="MouseLeftButtonUp">
                                                                                                <b:InvokeCommandAction
                                                                                                    Command="{cmds:Command PixiEditor.Colors.SelectColor, UseProvided=True}"
                                                                                                    CommandParameter="{Binding}" />
                                                                                            </b:EventTrigger>
                                                                                            <b:EventTrigger EventName="MouseLeftButtonUp">
                                                                                                <b:InvokeCommandAction
                                                                                                    Command="{cmds:Command PixiEditor.CloseContextMenu, UseProvided=True}"
                                                                                                    CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,
                                                                                                     AncestorType={x:Type ContextMenu}}}" />
                                                                                            </b:EventTrigger>
                                                                                        </b:Interaction.Triggers>
                                                                                    </palettes:PaletteColorControl>
                                                                                </DataTemplate>
                                                                            </ItemsControl.ItemTemplate>
                                                                        </ItemsControl>
                                                                    </ScrollViewer>
                                                                </Grid>
                                                            </Border>
                                                        </ControlTemplate>
                                                    </ContextMenu.Template>
                                                </ContextMenu>
                                            </usercontrols:Viewport.ContextMenu>
                                        </usercontrols:Viewport>
                                    </DataTemplate>
                                </ui:DocumentsTemplateSelector.DocumentsViewTemplate>
                            </ui:DocumentsTemplateSelector>
                        </DockingManager.LayoutItemTemplateSelector>
                        <avalondock:LayoutRoot x:Name="LayoutRoot">
                            <LayoutPanel Orientation="Horizontal">
                                <LayoutDocumentPane/>
                                <LayoutAnchorablePaneGroup Orientation="Vertical" DockWidth="290">

                                    <LayoutAnchorablePane x:Name="colorPane">
                                        <LayoutAnchorable ContentId="colorPicker" ui1:Translator.Key="COLOR_PICKER_TITLE" CanHide="False"
                                                      CanClose="False" CanAutoHide="False" x:Name="colorPickerPanel"
                                                      CanDockAsTabbedDocument="False" CanFloat="True">
                                            <usercontrols:SmallColorPicker SelectedColor="{Binding ColorsSubViewModel.PrimaryColor, Mode=TwoWay, Converter={StaticResource BackendColorToMediaColorConverter}}"
                                                                         SecondaryColor="{Binding ColorsSubViewModel.SecondaryColor, Mode=TwoWay, Converter={StaticResource BackendColorToMediaColorConverter}}"
                                                                         Style="{StaticResource DefaultColorPickerStyle}" x:Name="mainColorPicker">
                                                <b:Interaction.Behaviors>
                                                    <behaviours:GlobalShortcutFocusBehavior/>
                                                </b:Interaction.Behaviors>
                                            </usercontrols:SmallColorPicker>
                                        </LayoutAnchorable>
                                        <LayoutAnchorable ContentId="colorSliders" ui1:Translator.Key="COLOR_SLIDERS_TITLE" CanHide="False"
                                                      CanClose="False" CanAutoHide="False" x:Name="colorSlidersPanel"
                                                      CanDockAsTabbedDocument="False" CanFloat="True">
                                            <colorpicker:ColorSliders Style="{StaticResource DefaultColorPickerStyle}" 
                                                                  ColorState="{Binding ElementName=mainColorPicker, Path=ColorState, Delay=10, Mode=TwoWay}">
                                                <b:Interaction.Behaviors>
                                                    <behaviours:GlobalShortcutFocusBehavior/>
                                                </b:Interaction.Behaviors>
                                            </colorpicker:ColorSliders>
                                        </LayoutAnchorable>
                                        <avalondock:LayoutAnchorable ContentId="palette" ui1:Translator.Key="PALETTE_TITLE" CanHide="False"
                                                                 CanClose="False" CanAutoHide="False" x:Name="paletteAnchorable"
                                                                 CanDockAsTabbedDocument="False" CanFloat="True">
                                            <Grid>
                                                <palettes:CompactPaletteViewer 
                                                    IsEnabled="{Binding DocumentManagerSubViewModel.ActiveDocument, Converter={converters:NotNullToBoolConverter}}"
                                                    SelectColorCommand="{cmds:Command PixiEditor.Colors.SelectColor, UseProvided=True}"
                                                    Colors="{Binding DocumentManagerSubViewModel.ActiveDocument.Palette}" 
                                                    Visibility="{Binding RelativeSource={RelativeSource Mode=Self}, Path=ActualWidth, Converter={converters:PaletteViewerWidthToVisibilityConverter}}"/>
                                                <palettes:PaletteViewer 
                                                    IsEnabled="{Binding DocumentManagerSubViewModel.ActiveDocument, Converter={converters:NotNullToBoolConverter}}"
                                                    Colors="{Binding DocumentManagerSubViewModel.ActiveDocument.Palette}"
                                                    Swatches="{Binding DocumentManagerSubViewModel.ActiveDocument.Swatches}"
                                                    SelectColorCommand="{cmds:Command PixiEditor.Colors.SelectColor, UseProvided=True}"
                                                    HintColor="{Binding Path=ColorsSubViewModel.PrimaryColor,Converter={converters:GenericColorToMediaColorConverter}}"
                                                    PaletteProvider="{Binding ColorsSubViewModel.PaletteProvider}"
                                                    Visibility="{Binding RelativeSource={RelativeSource Mode=Self}, Path=ActualWidth, Converter={converters:PaletteViewerWidthToVisibilityConverter}, ConverterParameter=Hidden}"
                                                    ImportPaletteCommand="{cmds:Command PixiEditor.Colors.ImportPalette, UseProvided=True}"
                                                    ReplaceColorsCommand="{cmds:Command PixiEditor.Colors.ReplaceColors, UseProvided=True}"/>
                                            </Grid>
                                        </avalondock:LayoutAnchorable>
                                        <avalondock:LayoutAnchorable
										ContentId="swatches"
										ui1:Translator.Key="SWATCHES_TITLE"
										CanHide="False"
										CanClose="False"
										CanAutoHide="False"
										CanDockAsTabbedDocument="False"
										CanFloat="True">
                                            <usercontrols:SwatchesView
											    SelectSwatchCommand="{cmds:Command PixiEditor.Colors.SelectColor, UseProvided=True}"
											    Swatches="{Binding DocumentManagerSubViewModel.ActiveDocument.Swatches}" />
                                        </avalondock:LayoutAnchorable>
                                    </LayoutAnchorablePane>
                                    <LayoutAnchorablePane>
                                        <LayoutAnchorable
                                            ContentId="layers"
                                            ui1:Translator.Key="LAYERS_TITLE"
                                            CanHide="False"
                                            CanClose="False"
                                            CanAutoHide="False"
                                            CanDockAsTabbedDocument="True"
                                            CanFloat="True">
                                            <layerUserControls:LayersManager
                                                ActiveDocument="{Binding DocumentManagerSubViewModel.ActiveDocument}"/>
                                        </LayoutAnchorable>
                                    </LayoutAnchorablePane>
                                    <LayoutAnchorablePane>
                                        <LayoutAnchorable
                                            ContentId="navigation"
                                            ui1:Translator.Key="NAVIGATION_TITLE"
                                            CanHide="True"
                                            CanAutoHide="False"
                                            CanDockAsTabbedDocument="False"
                                            CanFloat="True">
                                            <usercontrols:PreviewWindow
                                                Document="{Binding DataContext.DocumentManagerSubViewModel.ActiveDocument, ElementName=mainWindow}"
                                                PrimaryColor="{Binding ColorsSubViewModel.PrimaryColor, Mode=TwoWay, Converter={StaticResource BackendColorToMediaColorConverter}}" />
                                        </LayoutAnchorable>
                                    </LayoutAnchorablePane>
                                </LayoutAnchorablePaneGroup>
                            </LayoutPanel>
                        </avalondock:LayoutRoot>
                    </DockingManager>
                </Grid>
            </Grid>

            <Border
                Grid.Row="2"
                Grid.Column="0"
                Background="{StaticResource AccentColor}"
                Grid.RowSpan="2"
                CornerRadius="5,0,5,5">
                <Grid Cursor="Arrow">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>

                    <ScrollViewer VerticalScrollBarVisibility="Auto">
                        <ItemsControl
                            ItemsSource="{Binding ToolsSubViewModel.ToolSet}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Button
                                        BorderBrush="White"
                                        BorderThickness="{Binding IsActive, Converter={StaticResource BoolToIntConverter}}"
                                        Style="{StaticResource ToolButtonStyle}"
                                        Command="{cmds:Command PixiEditor.Tools.SelectTool, UseProvided=True}"
                                        CommandParameter="{Binding}"
                                        ui1:Translator.TooltipLocalizedString="{Binding Tooltip}"
                                        ui1:Translator.TooltipKey="{Binding Tooltip.Key}">
                                        <Button.Background>
                                            <ImageBrush
                                                RenderOptions.BitmapScalingMode="Fant"
                                                ImageSource="{Binding ImagePath}"
                                                Stretch="Uniform" />
                                        </Button.Background>
                                        <Button.Resources>
                                            <Style
                                                TargetType="Border">
                                                <Setter
                                                    Property="CornerRadius"
                                                    Value="2.5" />
                                            </Style>
                                        </Button.Resources>
                                    </Button>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="0.4*"/>
                        </Grid.ColumnDefinitions>
                        
                        <Border Background="{Binding ColorsSubViewModel.PrimaryColor, Mode=TwoWay, Converter={converters:GenericColorToMediaColorConverter}}"
                                BorderBrush="Gray" BorderThickness="1" CornerRadius="0,0,5,5"
                                Grid.ColumnSpan="2"/>
                        <Border Background="{Binding ColorsSubViewModel.SecondaryColor, Mode=TwoWay, Converter={converters:GenericColorToMediaColorConverter}}"
                                Margin="0,1,1,1" CornerRadius="0,0,5,0"
                                Grid.Column="1"/>
                    </Grid>
                </Grid>
            </Border>

            <Border 
                Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2" 
                Background="#881d1d1d"
                Cursor=""
                Visibility="{Binding DocumentManagerSubViewModel.ActiveDocument.Busy, Converter={StaticResource BoolToVisibilityConverter}, FallbackValue={x:Static Visibility.Collapsed}, Source={vm:MainVM}}">
                <Image 
                    gif:ImageBehavior.AnimatedSource="/Images/Processing.gif" 
                    HorizontalAlignment="Center" VerticalAlignment="Center"
                    Height="50" 
                    gif:ImageBehavior.AnimationSpeedRatio="1.5"/>
            </Border>
            
            <Grid
                Grid.Row="3"
                Grid.Column="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition
                        Width="*" />
                    <ColumnDefinition
                        Width="290" />
                </Grid.ColumnDefinitions>
                <DockPanel>
                    <TextBlock
                        ui1:Translator.LocalizedString="{Binding ActiveActionDisplay}"
                        Foreground="White"
                        FontSize="15"
                        Margin="10,0,0,0"
                        VerticalAlignment="Center" />
                    <StackPanel
                        DockPanel.Dock="Right"
                        Orientation="Horizontal"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center">
                        <TextBlock
                            Text="{Binding ElementName=mainWindow, Path=DataContext.DocumentManagerSubViewModel.ActiveDocument.CoordinatesString}"
                            Foreground="White"
                            FontSize="16" />
                    </StackPanel>
                </DockPanel>
                <StackPanel
                    Margin="10,0,0,0"
                    VerticalAlignment="Center"
                    Grid.Row="3"
                    Grid.Column="3"
                    Orientation="Horizontal">
                    <Button
                        Style="{StaticResource BaseDarkButton}"
                        Visibility="{Binding UpdateSubViewModel.UpdateReadyToInstall, Converter={StaticResource BoolToVisibilityConverter}, FallbackValue=Hidden}"
                        FontSize="14"
                        Height="20"
                        Command="{cmds:Command PixiEditor.Restart}" ui1:Translator.Key="RESTART"/>
                    <TextBlock
                        VerticalAlignment="Center"
                        Padding="10"
                        HorizontalAlignment="Right"
                        Foreground="White"
                        FontSize="14"
                        Text="{Binding UpdateSubViewModel.VersionText}" />
                </StackPanel>
            </Grid>
        </Grid>
        <commandSearch:CommandSearchControl
            Visibility="{Binding SearchSubViewModel.SearchWindowOpen, Converter={BoolToVisibilityConverter}, Mode=TwoWay}"
            SearchTerm="{Binding SearchSubViewModel.SearchTerm, Mode=TwoWay}"
            HorizontalAlignment="Center"
            Height="700"
            MaxWidth="920" />
    </Grid>
</Window>
