<controls:MetroWindow xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      xmlns:dock="http://schemas.xceed.com/wpf/xaml/avalondock"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:stheme="clr-namespace:SPCode.UI.STheme"
                      xmlns:av="http://schemas.microsoft.com/expression/blend/2008" 
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                      mc:Ignorable="av" 
                      x:Name="metroWindow" 
                      x:Class="SPCode.UI.MainWindow"
                      SaveWindowPosition="True"
                      GlowBrush="{DynamicResource AccentColorBrush}" 
                      MinHeight="100" 
                      MinWidth="200" 
                      KeyDown="MainWindowEvent_KeyDown" 
                      Closing="MetroWindow_Closing"
                      AllowDrop="True" 
                      Drop="MetroWindow_Drop" 
                      ShowIconOnTitleBar="False" 
                      TitleCaps="False" 
                      av:DesignHeight="396" 
                      av:DesignWidth="765.333">

  <controls:MetroWindow.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" />
        <ResourceDictionary>

          <!-- Button style with pressed effects -->

          <Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
            <Setter Property="Background" Value="{DynamicResource WhiteBrush}"/>
            <Setter Property="Template">
              <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                  <Border Background="{TemplateBinding Background}" BorderBrush="{DynamicResource AccentColorBrush}">
                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                  </Border>
                </ControlTemplate>
              </Setter.Value>
            </Setter>
            <Style.Triggers>
              <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource AccentColorBrush4}"/>
              </Trigger>
              <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{DynamicResource AccentColorBrush2}"/>
              </Trigger>
            </Style.Triggers>
          </Style>

          <Style x:Key="ButtonStyle2" TargetType="{x:Type Button}">
            <Setter Property="Background" Value="{DynamicResource WhiteBrush}"/>
            <Setter Property="Template">
              <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                  <Border Background="{TemplateBinding Background}" BorderBrush="{DynamicResource GrayBrush5}" BorderThickness="1">
                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                  </Border>
                </ControlTemplate>
              </Setter.Value>
            </Setter>
            <Style.Triggers>
              <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource GrayBrush7}"/>
              </Trigger>
              <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{DynamicResource GrayBrush8}"/>
              </Trigger>
            </Style.Triggers>
          </Style>

          <Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}">
            <Setter Property="Background" Value="{DynamicResource WhiteBrush}"/>
            <Setter Property="Template">
              <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                  <Border Background="{TemplateBinding Background}" BorderBrush="{DynamicResource GrayBrush5}" BorderThickness="{TemplateBinding BorderThickness}">
                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                  </Border>
                  <ControlTemplate.Triggers>
                    <Trigger Property="IsChecked" Value="False">
                      <Setter Property="BorderThickness" Value="0"/>
                    </Trigger>
                    <Trigger Property="IsChecked" Value="True">
                      <Setter Property="BorderThickness" Value="1"/>
                    </Trigger>
                  </ControlTemplate.Triggers>
                </ControlTemplate>
              </Setter.Value>
            </Setter>
            <Style.Triggers>
              <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource GrayBrush7}"/>
              </Trigger>
              <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{DynamicResource GrayBrush8}"/>
              </Trigger>
            </Style.Triggers>
          </Style>

          <!--Button Images-->

          <Image x:Key="ImgReload" Source="/SPCode;component/Resources/Icons/icon-reload.png" Width="16"/>
          <Image x:Key="ImgCollapse" Source="/SPCode;component/Resources/Icons/icon-collapse.png" Width="16"/>
          <Image x:Key="ImgExpand" Source="/SPCode;component/Resources/Icons/icon-expand.png" Width="16"/>

          <!--BlendOverEffect used on save and such-->

          <Storyboard x:Key="BlendOverEffect" Duration="00:00:00.5" Storyboard.TargetName="BlendEffectPlane" Storyboard.TargetProperty="Opacity">
            <DoubleAnimationUsingKeyFrames>
              <SplineDoubleKeyFrame Value="0.0" KeyTime="00:00:00.00" />
              <SplineDoubleKeyFrame Value="0.5" KeyTime="00:00:00.25" />
              <SplineDoubleKeyFrame Value="0.0" KeyTime="00:00:00.50" />
            </DoubleAnimationUsingKeyFrames>
          </Storyboard>

          <Storyboard x:Key="DimmMainWindow" Duration="00:00:00.5" Storyboard.TargetName="BlendEffectPlane" Storyboard.TargetProperty="Opacity">
            <DoubleAnimationUsingKeyFrames>
              <SplineDoubleKeyFrame Value="0.0" KeyTime="00:00:00"/>
              <SplineDoubleKeyFrame Value="0.5" KeyTime="00:00:00.5"/>
            </DoubleAnimationUsingKeyFrames>
          </Storyboard>

          <Storyboard x:Key="RestoreMainWindow" Duration="00:00:00.5" Storyboard.TargetName="BlendEffectPlane" Storyboard.TargetProperty="Opacity">
            <DoubleAnimationUsingKeyFrames>
              <SplineDoubleKeyFrame Value="0.5" KeyTime="00:00:00"/>
              <SplineDoubleKeyFrame Value="0.0" KeyTime="00:00:00.5"/>
            </DoubleAnimationUsingKeyFrames>
          </Storyboard>

          <Storyboard x:Key="EnableServerAnim">
            <DoubleAnimation Duration="00:00:00.5" To="5" Storyboard.TargetName="ServerProgressBar" Storyboard.TargetProperty="Height" />
            <BooleanAnimationUsingKeyFrames Storyboard.TargetName="ServerProgressBar" Storyboard.TargetProperty="IsIndeterminate">
              <BooleanAnimationUsingKeyFrames.KeyFrames>
                <BooleanKeyFrameCollection>
                  <DiscreteBooleanKeyFrame KeyTime="00:00:00.25" Value="True" />
                </BooleanKeyFrameCollection>
              </BooleanAnimationUsingKeyFrames.KeyFrames>
            </BooleanAnimationUsingKeyFrames>
          </Storyboard>

          <Storyboard x:Key="DisableServerAnim">
            <DoubleAnimation Duration="00:00:00.5" To="0" Storyboard.TargetName="ServerProgressBar" Storyboard.TargetProperty="Height" />
            <BooleanAnimationUsingKeyFrames Storyboard.TargetName="ServerProgressBar" Storyboard.TargetProperty="IsIndeterminate">
              <BooleanAnimationUsingKeyFrames.KeyFrames>
                <BooleanKeyFrameCollection>
                  <DiscreteBooleanKeyFrame KeyTime="00:00:00.25" Value="False" />
                </BooleanKeyFrameCollection>
              </BooleanAnimationUsingKeyFrames.KeyFrames>
            </BooleanAnimationUsingKeyFrames>
          </Storyboard>

        </ResourceDictionary>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </controls:MetroWindow.Resources>

  <controls:MetroWindow.LeftWindowCommands>
    <controls:WindowCommands>
      <Grid x:Name="MainWindowCommands">
        <Menu>
          <MenuItem x:Name="MenuI_File" SubmenuOpened="FileMenu_Open">

            <MenuItem x:Name="MenuI_New" Click="Menu_New"/>
            <MenuItem x:Name="MenuI_NewTemplate" Click="Menu_NewFromTemplate"/>

            <Separator/>

            <MenuItem x:Name="MenuI_Open" Click="Menu_Open"/>
            <MenuItem x:Name="MenuI_Recent">
              <MenuItem.ContextMenu>
                <ContextMenu>
                  <MenuItem x:Name="MenuI_ClearRecent" Click="Menu_ClearRecent"/>
                </ContextMenu>
              </MenuItem.ContextMenu>
            </MenuItem>
            <MenuItem x:Name="MenuI_ReopenLastClosedTab" Click="Menu_ReopenLastClosedTab"/>

            <Separator />

            <MenuItem x:Name="MenuI_Save" Click="Menu_Save"/>
            <MenuItem x:Name="MenuI_SaveAll" Click="Menu_SaveAll"/>
            <MenuItem x:Name="MenuI_SaveAs" Click="Menu_SaveAs"/>

            <Separator />

            <MenuItem x:Name="MenuI_Close" Click="Menu_Close"/>
            <MenuItem x:Name="MenuI_CloseAll" Click="Menu_CloseAll"/>

          </MenuItem>

          <MenuItem x:Name="MenuI_Edit" SubmenuOpened="EditMenu_Open">
            <MenuItem x:Name="MenuI_Undo" Click="Menu_Undo"/>
            <MenuItem x:Name="MenuI_Redo" Click="Menu_Redo"/>
            <Separator />
            <MenuItem x:Name="MenuI_Cut" Click="Menu_Cut"/>
            <MenuItem x:Name="MenuI_Copy" Click="Menu_Copy"/>
            <MenuItem x:Name="MenuI_Paste" Click="Menu_Paste"/>
            <Separator />
            <MenuItem x:Name="MenuI_Folding">
              <MenuItem x:Name="MenuI_FoldingsExpand" Click="Menu_ExpandAll" />
              <MenuItem x:Name="MenuI_FoldingsCollapse" Click="Menu_CollapseAll" />
            </MenuItem>
            <MenuItem x:Name="MenuI_GoToLine" Click="Menu_JumpTo"/>
            <MenuItem x:Name="MenuI_CommentLine" Click="Menu_CommentLine"/>
            <MenuItem x:Name="MenuI_UncommentLine" Click="Menu_UncommentLine"/>
            <MenuItem x:Name="MenuI_SelectAll" Click="Menu_SelectAll"/>
            <Separator />
            <MenuItem x:Name="MenuI_SearchReplace" Click="Menu_FindAndReplace"/>
          </MenuItem>

          <MenuItem x:Name="MenuI_Build">
            <MenuItem x:Name="MenuI_CompileAll" Click="Menu_CompileAll"/>
            <MenuItem x:Name="MenuI_CompileCurrent" Click="Menu_Compile"/>
            <Separator/>
            <MenuItem x:Name="MenuI_CopyPlugins" Click="Menu_CopyPlugin"/>
            <MenuItem x:Name="MenuI_UploadFTP" Click="Menu_FTPUpload"/>
            <Separator/>
            <MenuItem x:Name="MenuI_StartServer" Click="Menu_StartServer"/>
            <MenuItem x:Name="MenuI_SendRCON" Click="Menu_SendRCon" />
          </MenuItem>

          <MenuItem x:Name="ConfigMenu" />

          <MenuItem x:Name="MenuI_Tools" >
            <MenuItem x:Name="OptionMenuEntry" Click="Menu_OpenOptions" />
            <Separator />
            <MenuItem x:Name="MenuI_SPAPI" >
              <MenuItem x:Name="MenuI_SearchDefinition" Click="Menu_OpenSPDef" />
              <MenuItem x:Name="MenuI_NewApiWeb" Click="Menu_OpenWebsiteFromTag" Tag="https://sm.alliedmods.net/new-api/" />
              <MenuItem x:Name="MenuI_BetaApiWeb" Click="Menu_OpenWebsiteFromTag" Tag="https://sourcemod.dev/" />
            </MenuItem>
            <MenuItem x:Name="MenuI_Reformatter" >
              <MenuItem x:Name="MenuI_ReformatCurrent" Click="Menu_ReFormatCurrent" />
              <MenuItem x:Name="MenuI_ReformatAll" Click="Menu_ReFormatAll" />
            </MenuItem>
            <MenuItem x:Name="MenuI_Decompile" Click="Menu_DecompileLysis" />
            <Separator />
            <MenuItem x:Name="MenuI_ReportBugGit" Click="ReportBug_Click" />
            <MenuItem x:Name="MenuI_Changelog" Click="Changelog_Click" />
            <MenuItem x:Name="UpdateCheckItem" Click="UpdateCheck_Click" />
            <Separator/>
            <MenuItem x:Name="MenuI_Help" Click="Menu_Help" />
            <MenuItem x:Name="MenuI_About" Click="Menu_About" />
          </MenuItem>
        </Menu>
      </Grid>
    </controls:WindowCommands>
  </controls:MetroWindow.LeftWindowCommands>
  
  <controls:MetroWindow.Icon>
    <BitmapImage UriSource="/SPCode;component/Resources/Icons/icon.ico" />
  </controls:MetroWindow.Icon>
  
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="299*"/>
      <ColumnDefinition Width="159*"/>
      <ColumnDefinition Width="140*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="1*" />
    </Grid.RowDefinitions>
    <Grid x:Name="ToolBarGrid" Grid.Row="0">
      <ToolBarTray x:Name="Win_ToolBar" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="0">
        <ToolBar x:Name="FirstToolbar">
          <Button x:Name="TB_New" Height="26" Width="26" Click="Menu_New">
            <Canvas Width="14" Height="16" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="16" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 43,30L 50.75,30L 43,22.25L 43,30 Z M 52,34L 39,34L 39,21L 24,21L 24,45L 20,45L 20,17L 43.25,17L 56,29.75L 56,59L 34,59L 34,55L 52,55L 52,34 Z M 28,38L 33,38L 33,46L 41,46L 41,51L 33,51L 33,59L 28,59L 28,51L 20,51L 20,46L 28,46L 28,38 Z M 20,59L 20,52L 24,52L 24,55L 27,55L 27,59L 20,59 Z "/>
            </Canvas>
          </Button>
          <Button x:Name="TB_Open" Height="26" Width="26" Click="Menu_Open">
            <Canvas Width="14" Height="16" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="16" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 20,17L 44,17L 56,29L 56,59L 20,59L 20,17 Z M 24,21L 24,55L 52,55L 52,34L 39,34L 39,21L 24,21 Z M 43,21L 43,30L 52,30L 43,21 Z "/>
            </Canvas>
          </Button>
          <Button x:Name="TB_Save" Height="26" Width="26" Click="Menu_Save">
            <Canvas Width="14" Height="16" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="16" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 20,20L 50.25,20L 56,25.75L 56,56L 20,56L 20,20 Z M 52,27.25L 48.75,24L 48,24L 48,37L 28,37L 28,24L 24,24L 24,52L 52,52L 52,27.25 Z M 39,24L 39,34L 44,34L 44,24L 39,24 Z "/>
            </Canvas>
          </Button>
          <Button x:Name="TB_SaveAll" Height="26" Width="26" Click="Menu_SaveAll">
            <Canvas Width="14" Height="16" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="16" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 48,39L 56,39L 56,49L 63.25,49L 52,60.25L 40.75,49L 48,49L 48,39 Z M 20,20L 50.25,20L 56,25.75L 56,38L 52,38L 52,27.25L 48.75,24L 48,24L 48,37L 28,37L 28,24L 24,24L 24,52L 42.25,52L 46.25,56L 20,56L 20,20 Z M 39,24L 39,34L 44,34L 44,24L 39,24 Z "/>
            </Canvas>
          </Button>
          <Separator />
          <Button x:Name="TB_Close" Height="26" Width="26" Click="Menu_Close">
            <Canvas Width="14" Height="14" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="14" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 26.9166,22.1667L 37.9999,33.25L 49.0832,22.1668L 53.8332,26.9168L 42.7499,38L 53.8332,49.0834L 49.0833,53.8334L 37.9999,42.75L 26.9166,53.8334L 22.1666,49.0833L 33.25,38L 22.1667,26.9167L 26.9166,22.1667 Z "/>
            </Canvas>
          </Button>
          <Button x:Name="TB_CloseAll" Height="26" Width="26" Click="Menu_CloseAll">
            <Canvas Width="14" Height="14" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="14" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 31.6667,19L 44.3333,19L 57,31.6667L 57,44.3333L 44.3333,57L 31.6667,57L 19,44.3333L 19,31.6667L 31.6667,19 Z M 26.4762,45.0454L 30.9546,49.5238L 38,42.4783L 45.0454,49.5238L 49.5237,45.0454L 42.4783,38L 49.5238,30.9546L 45.0454,26.4763L 38,33.5217L 30.9546,26.4762L 26.4762,30.9546L 33.5217,38L 26.4762,45.0454 Z "/>
            </Canvas>
          </Button>
        </ToolBar>
        <ToolBar x:Name="SecondToolbar">
          <Button x:Name="TB_Undo" Height="26" Width="26" Click="Menu_Undo">
            <Canvas Width="14" Height="14" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="14" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 35.8724,37.6042L 39.0391,40.7708L 50.5182,51.8542L 40.2266,51.8542L 25.1849,37.6041L 40.2266,23.3542L 50.5182,23.3542L 39.0391,34.4375L 35.8724,37.6042 Z "/>
            </Canvas>
          </Button>
          <Button x:Name="TB_Redo" Height="26" Width="26" Click="Menu_Redo">
            <Canvas Width="14" Height="14" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="14" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 39.8307,37.6042L 36.6641,34.4375L 25.1849,23.3542L 35.4766,23.3542L 50.5182,37.6042L 35.4766,51.8542L 25.1849,51.8542L 36.6641,40.7708L 39.8307,37.6042 Z "/>
            </Canvas>
          </Button>
          <Separator />
          <Button x:Name="TB_Cut" Height="26" Width="26" Click="Menu_Cut">
            <Canvas Width="14" Height="14" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="14" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 19,19L 27,19L 27,24L 19,24L 19,19 Z M 30,19L 38,19L 38,24L 30,24L 30,19 Z M 41,19L 49,19L 49,24L 41,24L 41,19 Z M 52,19L 57,19L 57,27L 52,27L 52,19 Z M 52,30L 57,30L 57,38L 52,38L 52,30 Z M 52,41L 57,41L 57,49L 52,49L 52,41 Z M 27,52L 35,52L 35,57L 27,57L 27,52 Z M 38,52L 46,52L 46,57L 38,57L 38,52 Z M 49,52L 57,52L 57,57L 49,57L 49,52 Z M 19,27L 24,27L 24,35L 19,35L 19,27 Z M 19,38L 24,38L 24,46L 19,46L 19,38 Z M 19,49L 24,49L 24,57L 19,57L 19,49 Z "/>
            </Canvas>
          </Button>
          <Button x:Name="TB_Copy" Height="26" Width="26" Click="Menu_Copy">
            <Canvas Width="14" Height="14" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="14" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 19,51L 19,19L 51,19L 51,29L 29,29L 29,51L 19,51 Z M 30,30L 59,30L 59,59L 30,59L 30,30 Z M 33,33L 33,56L 56,56L 56,33L 33,33 Z "/>
            </Canvas>
          </Button>
          <Button x:Name="TB_Paste" Height="26" Width="26" Click="Menu_Paste">
            <Canvas Width="14" Height="14" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
              <Path Width="14" Height="14" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 19,50.6667L 19,19L 50.6667,19L 50.6668,28.5003L 28.5,28.5002L 28.5,50.6667L 19,50.6667 Z M 58.5835,58.5836L 53.0415,58.5833L 58.5833,53.0416L 58.5835,58.5836 Z M 58.5833,45.1249L 58.5833,51.4585L 51.4584,58.5833L 45.1249,58.5833L 58.5833,45.1249 Z M 58.5833,35.6251L 35.6251,58.5834L 30.0833,58.5834L 30.0833,57.7918L 57.7918,30.0834L 58.5835,30.0836L 58.5833,35.6251 Z M 58.5833,43.5418L 43.5418,58.5833L 37.2082,58.5833L 58.5833,37.2082L 58.5833,43.5418 Z M 56.2084,30.0833L 30.0833,56.2085L 30.0833,49.8749L 49.8749,30.0834L 56.2084,30.0833 Z M 48.2918,30.0834L 30.0833,48.2918L 30.0833,41.9582L 41.9582,30.0834L 48.2918,30.0834 Z M 40.3751,30.0833L 30.0833,40.3751L 30.0833,34.0416L 34.0415,30.0833L 40.3751,30.0833 Z "/>
            </Canvas>
          </Button>
        </ToolBar>
        <ToolBar>
          <controls:SplitButton x:Name="CompileButton" Width="125" Margin="0,0,5,0" Click="MenuButton_Compile" />
          <controls:SplitButton x:Name="CActionButton" Width="100" Click="MenuButton_Action" />
        </ToolBar>
      </ToolBarTray>
    </Grid>
    <Grid Grid.Row="1" Grid.ColumnSpan="3" Background="{DynamicResource AccentColorBrush}">
      <controls:MetroProgressBar x:Name="ServerProgressBar" HorizontalAlignment="Stretch" IsIndeterminate="True" Height="0" MinHeight="0" Foreground="White" />
    </Grid>
    <Grid Grid.Row="2" Grid.ColumnSpan="3">
      <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition x:Name="CompileOutputRow" MinHeight="8" Height="8" />
      </Grid.RowDefinitions>
      <Grid Grid.Row="0" x:Name="EditorObjectBrowserGrid">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="1*" />
          <ColumnDefinition x:Name="ObjectBrowserColumn" Width="300" MinWidth="3" MaxWidth="{Binding ActualHeight, ElementName=metroWindow, Mode=OneWay}"/>
        </Grid.ColumnDefinitions>
        <dock:DockingManager Grid.Column="0" x:Name="DockingManager" Margin="0,0,5,0" AllowMixedOrientation="True" Background="{DynamicResource WhiteColorBrush}" Foreground="{DynamicResource BlackColorBrush}"
                                 ActiveContentChanged="DockingManager_ActiveContentChanged" DocumentClosed="DockingManager_DocumentClosed" >
          <dock:DockingManager.Theme>
            <stheme:SMetroTheme />
          </dock:DockingManager.Theme>
          <dock:LayoutRoot>
            <dock:LayoutPanel>
              <dock:LayoutDocumentPaneGroup x:Name="DockingPaneGroup" ChildrenTreeChanged="DockingPaneGroup_ChildrenTreeChanged">
                <dock:LayoutDocumentPane x:Name="DockingPane" />
              </dock:LayoutDocumentPaneGroup>
            </dock:LayoutPanel>
          </dock:LayoutRoot>
        </dock:DockingManager>
        <GridSplitter Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="5" Background="{DynamicResource GrayBrush5}" />
        <TreeView Grid.Column="1" x:Name="ObjectBrowser" TreeViewItem.Expanded="TreeViewOBItem_Expanded" 
                  TreeViewItem.Collapsed="TreeViewOBItem_Collapsed" PreviewMouseRightButtonDown="TreeViewOBItem_RightClicked" Margin="0,54,0,26"/>
        <TextBox x:Name="OBSearch" VerticalAlignment="Top" Margin="0,28,-1,0" Height="5" BorderThickness=".4" Grid.Column="1" BorderBrush="{DynamicResource AccentColorBrush3}"
                 TextChanged="OBSearch_TextChanged" PreviewKeyDown="OBSearch_PreviewKeyDown"/>
        <TextBlock x:Name="TxtSearchResults" Grid.Column="1" VerticalAlignment="Top" TextAlignment="Center" Margin="0,54,-1,0" 
                   Foreground="{DynamicResource BlackColorBrush}" Background="{DynamicResource WhiteColorBrush}" 
                   Height="30" Padding="4" IsEnabled="False" Visibility="Hidden"
                   FontWeight="Bold" FontSize="15"/>
        <ComboBox Grid.Column="1" x:Name="OBDirList" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="0" Height="5" BorderThickness="0" SelectionChanged="OBDirList_SelectionChanged"/>
        <ListView Grid.Column="1" x:Name="OBButtonHolder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0" Height="28" ScrollViewer.HorizontalScrollBarVisibility="Hidden" BorderThickness="0" SelectionMode="Single" BorderBrush="{DynamicResource TextBoxBorderBrush}">
          <ListView.ItemsPanel>
            <ItemsPanelTemplate>
              <StackPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
          </ListView.ItemsPanel>
          <ListViewItem x:Name="OBTabFile" Selected="ListViewOBItem_SelectFile">
            <StackPanel x:Name="FileDirButtonStackPanel" Orientation="Horizontal">
              <Image Source="/SPCode;component/Resources/Icons/icon-folder.png" Width="18" Height="18" />
              <TextBlock x:Name="OBItemText_File" Margin="5,0,0,0" />
            </StackPanel>
          </ListViewItem>
          <ListViewItem x:Name="OBTabConfig" Selected="ListViewOBItem_SelectConfig">
            <StackPanel x:Name="ConfigDirButtonStackPanel" Orientation="Horizontal">
              <Image Source="/SPCode;component/Resources/Icons/icon-gear.png" Width="18" Height="18" />
              <TextBlock x:Name="OBItemText_Config" Margin="5,0,0,0" />
            </StackPanel>
          </ListViewItem>
        </ListView>

        <Button x:Name="BtExpandCollapse" Style="{StaticResource ButtonStyle1}" Content="{StaticResource ImgExpand}" 
                Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Height="22" Width="22" Margin="0,3,2,0"
                Click="BtExpandCollapse_Click"/>

        <Button x:Name="BtRefreshDir" Style="{StaticResource ButtonStyle1}" Content="{StaticResource ImgReload}" 
                Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Height="22" Width="22" Margin="0,3,27,0"
                Click="BtRefreshDir_Click"/>

      </Grid>

      <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="5" Background="{DynamicResource GrayBrush5}" />

      <!-- Begin Lower Grids -->

      <!-- Lower Grid -->

      <Grid Grid.Row="1" Margin="0,5,0,0">

        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="5*" />
          <ColumnDefinition Width="2*" />
          <ColumnDefinition Width="35" />
        </Grid.ColumnDefinitions>

        <!--Close Lower Grid Button-->
        <Button Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top" Width="30" Height="30" Margin="0,5,0,0" Style="{DynamicResource ButtonStyle1}" Click="CloseErrorResultGrid">
          <Canvas Width="10" Height="10" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
            <Path Width="10" Height="10" Stretch="Fill" Fill="{DynamicResource AccentColorBrush}" Data="F1 M 26.9166,22.1667L 37.9999,33.25L 49.0832,22.1668L 53.8332,26.9168L 42.7499,38L 53.8332,49.0834L 49.0833,53.8334L 37.9999,42.75L 26.9166,53.8334L 22.1666,49.0833L 33.25,38L 22.1667,26.9167L 26.9166,22.1667 Z "/>
          </Canvas>
        </Button>

        <!--Log TextBox-->
        <TextBox x:Name="LogTextbox" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" TextWrapping="Wrap"
                         Margin="5,0,0,0" IsReadOnly="True" AcceptsReturn="True" AcceptsTab="True" VerticalScrollBarVisibility="Auto"
                         PreviewMouseRightButtonDown="LogTextbox_PreviewMouseRightButtonDown">
          <TextBox.Resources>
            <ContextMenu x:Name="LogContextMenu" x:Key="LogContextMenu" StaysOpen="true">
              <MenuItem x:Name="ClearLogsButton" Click="ClearLogs_Click"/>
            </ContextMenu>
          </TextBox.Resources>
        </TextBox>

        <!--Grid Splitter between Log TextBox and Error Grid-->
        <GridSplitter Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="5" Background="{DynamicResource GrayBrush5}" />

        <!--New Error Status Bar-->
        <StackPanel Orientation="Horizontal">
          
          <ToggleButton x:Name="Status_ErrorButton"
                      Style="{StaticResource ToggleButtonStyle}"
                      HorizontalAlignment="Left" VerticalAlignment="Top"
                      Margin="5,7,0,0"
                      Click="Status_ErrorButton_Clicked">
            <StackPanel Orientation="Horizontal">
              <Image Source="/SPCode;component/Resources/Icons/icon-error.png" 
                   Width="16" 
                   HorizontalAlignment="Center" VerticalAlignment="Center"
                   Margin="5,5,3,4"/>
              <TextBlock x:Name="Status_ErrorText"
                       HorizontalAlignment="Left" VerticalAlignment="Top"
                       Margin="3,4,5,2" />
            </StackPanel>
          </ToggleButton>

          <ToggleButton x:Name="Status_WarningButton"
                      Style="{StaticResource ToggleButtonStyle}"
                      HorizontalAlignment="Left" VerticalAlignment="Top"
                      Margin="10,7,0,0"
                      Click="Status_WarningButton_Clicked">
            <StackPanel Orientation="Horizontal">
              <Image Source="/SPCode;component/Resources/Icons/icon-warning.png" 
                   Width="16" 
                   HorizontalAlignment="Center" VerticalAlignment="Center"
                   Margin="10,5,3,4"/>
              <TextBlock x:Name="Status_WarningText"
                       HorizontalAlignment="Left" VerticalAlignment="Top"
                       Margin="3,4,5,2" />
            </StackPanel>
          </ToggleButton>

          <Button x:Name="Status_CopyErrorsButton"
                HorizontalAlignment="Left" VerticalAlignment="Top"
                Margin="10,9,0,0"
                Style="{StaticResource ButtonStyle2}"
                Height="22"
                Width="99"
                Click="Status_CopyErrorsButton_Click"/>
        </StackPanel>
        <!--Errors Button-->

        <!--Error DataGrid-->
        <DataGrid x:Name="ErrorResultGrid" 
                  Grid.Column="0"
                  IsReadOnly="True"
                  SelectionMode="Single" 
                  AutoGenerateColumns="true" 
                  SelectionChanged="ErrorResultGrid_SelectionChanged" Margin="0,40,0,0">

          <DataGrid.ItemContainerStyle>
            <Style TargetType="DataGridRow">
              <EventSetter Event="MouseDown" Handler="ErrorResultGrid_Click"/>
            </Style>
          </DataGrid.ItemContainerStyle>

          <DataGrid.Columns>
            <DataGridTextColumn x:Name="MenuC_FileName" Width="7*" Binding="{Binding File}" />
            <DataGridTextColumn x:Name="MenuC_Line" Width="1*" Binding="{Binding Line}" />
            <DataGridTextColumn x:Name="MenuC_Type" Width="2*" Binding="{Binding Type}" />
            <DataGridTextColumn x:Name="MenuC_Details" Width="9*" Binding="{Binding Details}" />
          </DataGrid.Columns>
        </DataGrid>

      </Grid>
    </Grid>

    <Rectangle Grid.Row="2" x:Name="BlendEffectPlane" IsHitTestVisible="False" Opacity="0" Fill="{DynamicResource AccentColorBrush4}" Grid.ColumnSpan="3" />
  </Grid>
</controls:MetroWindow>
