<controls:MetroWindow x:Name="NewFileWind"
                      x:Class="SPCode.UI.Windows.NewFileWindow"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:uc="clr-namespace:SPCode.UI.Components"
                      Width="1000" 
                      Height="700" 
                      MinWidth="800"
                      MinHeight="500"
                      ResizeMode="CanResizeWithGrip" 
                      WindowStartupLocation="CenterOwner" 
                      GlowBrush="{DynamicResource AccentColorBrush}"
                      TitleCharacterCasing="Normal"
                      ShowTitleBar="True" 
                      KeyDown="NewFileWind_KeyDown"
                      Closing="NewFileWind_Closing">

  <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.MergedDictionaries>
    </ResourceDictionary>
  </controls:MetroWindow.Resources>
  
  <Grid x:Name="NewFileWindowMainGrid">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="17*"/>
      <ColumnDefinition Width="183*"/>
    </Grid.ColumnDefinitions>

    <ListBox 
      Name="TemplateListBox" 
      HorizontalAlignment="Left" 
      Width="250" 
      Margin="0,0,0,50" 
      SelectionChanged="TemplateListBox_SelectionChanged" 
      Grid.ColumnSpan="2">

      <ListBox.ContextMenu>
        <ContextMenu>
          <MenuItem x:Name="AddTemplateButton" Click="TemplateListItem_Context_Add"/>
          <MenuItem x:Name="EditTemplateButton" Click="TemplateListItem_Context_Edit"/>
          <MenuItem x:Name="DeleteTemplateButton" Click="TemplateListItem_Context_Delete"/>
        </ContextMenu>
      </ListBox.ContextMenu>

    </ListBox>

    <TextBlock Name="PreviewBlock" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="192,10,0,0" IsHitTestVisible="False" Grid.Column="1" />

    <uc:EditorElement 
      x:Name="PreviewBox" 
      Margin="192,30,5,50" 
      Grid.Column="1">

    </uc:EditorElement>
    <TextBox Name="PathBox" VerticalAlignment="Bottom" Margin="5,0,215,5" 
                 Style="{StaticResource SearchMetroTextBox}"
                 controls:TextBoxHelper.ButtonCommand="{Binding TextBoxButtonFileCmd, Mode=OneWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" Grid.ColumnSpan="2" />
    <Button Name="SaveButton" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,5,5" Width="100" Click="SaveButton_Click" Grid.Column="1" />
    <Button Name="CancelButton" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,110,5" Width="100" Click="CancelButton_Click" Grid.Column="1" />
    <TextBox x:Name="TbxRenameTemplate" Grid.Column="1" Visibility="Collapsed" HorizontalAlignment="Left" Margin="245,6,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="343" Height="21"/>
    <Label x:Name="LblError" Grid.Column="1" FontWeight="Bold" FontSize="12" Visibility="Collapsed" Foreground="Red" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="375,5,0,0" VerticalAlignment="Top" Width="208" Height="26"/>
  </Grid>
</controls:MetroWindow>
