<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:Microsoft.Practices.EnterpriseLibrary.Configuration.Design.Controls;assembly=Microsoft.Practices.EnterpriseLibrary.Configuration.DesignTime"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Hosting="clr-namespace:Microsoft.Practices.EnterpriseLibrary.Configuration.Design.Hosting;assembly=Microsoft.Practices.EnterpriseLibrary.Configuration.DesignTime"
		x:Class="Microsoft.Practices.EnterpriseLibrary.Configuration.Console.Shell"
		Title="{Binding ApplicationTitle}"
        Icon="Icons\entlib_new_icon_32x32.ico"
		BorderThickness="0" mc:Ignorable="d"
        Closing="Window_Closing" Loaded="Window_Loaded">

    <Grid Hosting:ConfigurationResources.MergedDictionaries="ExpanderDictionary;ViewModelDataTemplates;BlockSpecificTemplates;ExtendedDictionary">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="5*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Menu Grid.Row="0">
            <MenuItem Header="_File" AutomationProperties.AutomationId="File">
                <MenuItem Header="_New..."
                              Command="{Binding NewConfigurationCommand}"
                              InputGestureText="Ctrl + N"
                              AutomationProperties.AutomationId="New..." />
                <MenuItem Header="_Open..."
							  Command="{Binding OpenConfigurationCommand}"
                              InputGestureText="Ctrl + O"
                              AutomationProperties.AutomationId="Open..." />
                <MenuItem Header="_Save"
							  Command="{Binding SaveConfigurationCommand}" 
                              InputGestureText="Ctrl + S" 
                              AutomationProperties.AutomationId="Save" />
                <MenuItem Header="Save _As..."
							  Command="{Binding SaveAsConfigurationCommand}" 
                              InputGestureText="Ctrl + A"
                              AutomationProperties.AutomationId="Save As..."/>
                <Separator/>
                <MenuItem Header="E_xit"
							  Command="{Binding ExitCommand}" AutomationProperties.AutomationId="Exit" />

            </MenuItem>

            <MenuItem Header="_Blocks" x:Name="AddApplicationBlockMenu" AutomationProperties.AutomationId="Blocks" ItemsSource="{Binding BlockCommands}" Style="{StaticResource CommandMenuItemStyle}" />
            <MenuItem Header="_Wizards" x:Name="WizardMenu" AutomationProperties.AutomationId="WizardMenu" ItemsSource="{Binding WizardCommands}" Style="{StaticResource CommandMenuItemStyle}" />

            <MenuItem Header="_Environments" x:Name="EnvironmentsMenu" AutomationProperties.AutomationId="Environments" >
                <MenuItem Header="_New Environment..."
							  Command="{Binding NewEnvironmentCommand}" AutomationProperties.AutomationId="New Environment..." />

                <MenuItem Header="_Open Delta File..."
							  Command="{Binding OpenEnvironmentCommand}" AutomationProperties.AutomationId="Open Delta File..." />

            </MenuItem>
        </Menu>

        <Hosting:SectionView Grid.Row="1" DataContext="{Binding}" />

        <GridSplitter Grid.Row="2" ResizeDirection="Rows" Height="6" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,1,0,0" Background="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}" />
        <Border Grid.Row="3" BorderThickness="1" BorderBrush="Gray" Margin="1" Padding="5,5,5,5">
            <Grid>
                <TextBlock Grid.Row="0" Height="Auto" Text="Errors" HorizontalAlignment="Stretch"  />
                <ListView Grid.Row="1" x:Name="errorListView" 
                                    ItemsSource="{Binding ValidationModel.ValidationResults}" 
                                    Controls:DoubleClickCommand.CommandParameter="{Binding ElementName=errorListView, Path=SelectedItem}"
                                    Controls:DoubleClickCommand.Command="{Binding ValidationModel.NavigateCommand}" >
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Element" DisplayMemberBinding="{Binding ElementName}" />
                            <GridViewColumn Header="Property" DisplayMemberBinding="{Binding PropertyName}" />
                            <GridViewColumn Header="Message">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Message}" TextWrapping="Wrap"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Severity" DisplayMemberBinding="{Binding IsWarning, Converter={StaticResource IsWarningToTextConverter}}" />
                        </GridView>
                    </ListView.View>
                </ListView>
            </Grid>
        </Border>
    </Grid>
</Window>
	