<Window x:Class="Microsoft.VisualStudio.TestTools.TestCaseMigrator.TestCaseImportWizard"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:TestCaseMigrator="clr-namespace:Microsoft.VisualStudio.TestTools.TestCaseMigrator"
        Title="Test Case Migrator" 
        x:ClassModifier="internal"
        Background="#FFE0E0E0"
        ResizeMode="CanMinimize"
        Height="600" 
        Closing="Window_Closing"
        Width="750">
    <Window.Resources>
        <!-- Converters -->
        <TestCaseMigrator:WizardPartToVisualConverter x:Key="WizardPartToVisualConverter" />
        <TestCaseMigrator:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />
        <TestCaseMigrator:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <TestCaseMigrator:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" />
        <TestCaseMigrator:InverseBooleanConverter x:Key="InverseBooleanConverter" />

        <Style x:Key="NavigationButtonStyle"
               TargetType="{x:Type Button}">
            <Setter Property="Padding" Value="7" />
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border Name="Border"
                                BorderThickness="1"
                                BorderBrush="Transparent">
                            <TextBlock Text="{Binding Header}"
                                       FontSize="14"
                                       TextTrimming="CharacterEllipsis"
                                       ToolTip="{Binding Header}"
                                       Margin="8,4,2,2">
                                <TextBlock.Style>
                                    <Style TargetType="{x:Type TextBlock}">
                                        <Setter Property="FontWeight" Value="Normal" />
                                        <Setter Property="Foreground" Value="Black" />
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding CanShow}"
                                                         Value="False">
                                                <Setter Property="Foreground" Value="Gray" />
                                            </DataTrigger>
                                            <DataTrigger Binding="{Binding IsActiveWizardPart}" 
                                                         Value="True">
                                                <Setter Property="FontWeight" Value="Bold" />
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver"
                                         Value="True">
                                <Setter TargetName="Border"
                                        Property="BorderBrush"
                                        Value="{DynamicResource HoverBorderBrush}" />
                            </Trigger>
                            <DataTrigger Binding="{Binding IsActiveWizardPart}" 
                                        Value="True">
                                <Setter TargetName="Border"
                                        Property="BorderBrush"
                                        Value="Gray" />
                            </DataTrigger>

                        </ControlTemplate.Triggers>
                    </ControlTemplate>

                </Setter.Value>
            </Setter>
        </Style>

        <DataTemplate x:Key="WizardNavigationPanelItemTemplate">
            <Button x:Name="WizardNavigationButton"
                    Style="{StaticResource NavigationButtonStyle}"
                    IsEnabled="{Binding CanShow}"
                    Click="WizardNavigationButton_Click" />
        </DataTemplate>

    </Window.Resources>

    <Grid>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="170" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <ItemsControl Grid.Row="0"
                      Grid.RowSpan="4"
                      Grid.Column="0"
                      BorderBrush="Gray"
                      BorderThickness="1"
                      Background="White"
                      ItemsSource="{Binding WizardParts}"
                      ItemTemplate="{StaticResource WizardNavigationPanelItemTemplate}" />

            <!-- ====================================== Wizard Header ============================================= -->
            <StackPanel Grid.Row="0"
                    Grid.Column="1"
                    VerticalAlignment="Top"
                    Margin="7,8,10,0">
                <TextBlock Text="{Binding WizardPart.Header, Mode=OneWay}"
                       FontWeight="Bold"
                       FontSize="16"/>
                <TextBlock Text="{Binding WizardPart.Description}" 
                       Margin="10,5,0,5"
                       Visibility="{Binding WizardPart.Description, Converter={StaticResource StringToVisibilityConverter}}"
                       TextWrapping="Wrap"/>
            </StackPanel>

            <Separator Grid.Row="1"
                   Grid.Column="1"
                   VerticalAlignment="Top" 
                   Margin="7"/>

            <!-- ====================================== Wizard Body =============================================== -->

            <ContentPresenter Grid.Row="2"
                          Grid.Column="1"
                          Margin="11,5,11,2"
                          Content="{Binding WizardPart, Converter={StaticResource WizardPartToVisualConverter}}"/>


            <!-- ===================================== Wizard Footer ============================================== -->
            <Separator Grid.Row="3"
                   Grid.Column="1"
                   VerticalAlignment="Bottom" 
                   Margin="7,7,7,0"/>

            <Grid Grid.Row="4"
              Grid.Column="0"
              Grid.ColumnSpan="2"
              VerticalAlignment="Bottom"
              Margin="7,14,7,7">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Button Grid.Column="0" 
                    x:Uid="HelpButton"
                    Style="{DynamicResource NavigationButton}"
                    Name="HelpButton" 
                    Content="Help"
                    Click="HelpButton_Click" />

                <StackPanel Grid.Column="1"
                        HorizontalAlignment="Right" 
                        Orientation="Horizontal">

                    <Button Name="BackButton" 
                        x:Uid="BackButton"
                        Content="&lt; _Back" 
                        Style="{DynamicResource NavigationButton}"
                        IsEnabled="{Binding WizardPart.CanBack}"
                        Visibility="{Binding IsSummaryPage, Converter={StaticResource InverseBooleanToVisibilityConverter}}"
                        Click="BackButton_Click" />

                    <Button Name="NextButton" 
                        x:Uid="NextButton"
                        Content="_Next &gt;"
                        Style="{DynamicResource NavigationButton}"
                        Visibility="{Binding IsFinishVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                        IsEnabled="{Binding WizardPart.CanNext}"
                        Click="NextButton_Click" />

                    <Button Name="FinishButton"
                        x:Uid="FinishButton"
                        Style="{DynamicResource NavigationButton}"
                        Content="_Confirm &gt;&gt;"
                        Visibility="{Binding IsFinishVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                        IsEnabled="{Binding CanFinish}"
                        Click="FinishButton_Click" />

                    <Button Name="SaveandExitButton" 
                        x:Uid="SaveandExitButton"
                        Style="{DynamicResource NavigationButton}"
                        Content="_Save and exit"
                        IsEnabled="{Binding CanSave}"
                        Visibility="{Binding IsConfirmPage, Converter={StaticResource BooleanToVisibilityConverter}}"
                        Click="SaveandExitButton_Click" />

                    <Button Name="SaveAndMigrateButton" 
                        x:Uid="SaveAndMigrateButton"
                        Style="{DynamicResource NavigationButton}"
                        Content="Save and _migrate"
                        Visibility="{Binding IsConfirmPage, Converter={StaticResource BooleanToVisibilityConverter}}"
                        Click="SaveAndMigrateButton_Click" />

                    <Button Name="CloseButton"
                        x:Uid="CloseButton"
                        Style="{DynamicResource NavigationButton}"
                        Content="_Close"
                        Visibility="{Binding IsSummaryPage, Converter={StaticResource BooleanToVisibilityConverter}}"
                        Click="CloseButton_Click" />

                    <Button Name="CancelButton" 
                        x:Uid="CancelButton"
                        Style="{DynamicResource NavigationButton}"
                        Visibility="{Binding IsSummaryPage, Converter={StaticResource InverseBooleanToVisibilityConverter}}"
                        Content="_Cancel"
                        Click="CancelButton_Click" />
                </StackPanel>
            </Grid>
        </Grid>

        <Grid>
            <Grid.Style>
                <Style TargetType="{x:Type Grid}">
                    <Setter Property="Visibility" Value="Visible" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding WizardInfo.ProgressPart}"
                                     Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <Border Background="Black"
                    Opacity="0.2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch" />
            <Border Background="White"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"
                        Height="200"
                        CornerRadius="3"
                        Width="400">
                <Border.Effect>
                    <DropShadowEffect Color="Black"
                          BlurRadius="50"
                          ShadowDepth="10"
                          Direction="30"
                          />
                </Border.Effect>
                <Border VerticalAlignment="Stretch"
                            HorizontalAlignment="Stretch">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid Grid.Row="0">
                            <Grid.Background>
                                <LinearGradientBrush>
                                    <GradientStop Offset="0" Color="White"/>
                                    <GradientStop Offset="0.2" Color="LightGray"/>
                                    <GradientStop Offset="1" Color="Gray"/>
                                </LinearGradientBrush>

                            </Grid.Background>
                            <TextBlock Text="{Binding WizardInfo.ProgressPart.Title}"
                                           FontSize="15"
                                           Margin="12"
                                           TextWrapping="Wrap"
                                           VerticalAlignment="Center"
                                           HorizontalAlignment="Stretch" />
                        </Grid>
                        <Grid Grid.Row="1"
                                  Margin="10">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <ScrollViewer VerticalScrollBarVisibility="Auto"
                                          Grid.Row="0">
                                <TextBlock Text="{Binding WizardInfo.ProgressPart.Text}"
                                           FontSize="12"
                                           TextWrapping="Wrap"
                                           VerticalAlignment="Bottom"
                                           HorizontalAlignment="Stretch" />
                            </ScrollViewer>
                            <ProgressBar IsIndeterminate="False" 
                                         Value="{Binding WizardInfo.ProgressPart.ProgressValue}"
                                         Minimum="-4"
                                         Maximum="100"
                                             Margin="0,7,0,0"
                                             Grid.Row="1"
                                             Height="20"
                                             VerticalAlignment="Bottom" />
                        </Grid>
                        <Grid Grid.Row="2"
                                  Background="LightGray">
                            <Button Content="_Cancel" 
                                        Name="OverlayStopButton"
                                        Width="75"
                                        Margin="0,10,20,10"
                                        Padding="5"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Center"
                                        Click="ProgressPartCancelButton_Click"/>
                        </Grid>
                    </Grid>
                </Border>
            </Border>
        </Grid>

    </Grid>
</Window>