<nuget:VsDialogWindow
  x:Class="NuGet.PackageManagement.UI.PreviewWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:nuget="clr-namespace:NuGet.PackageManagement.UI"
  x:Name="_self"
  ShowInTaskbar="False"
  WindowStyle="SingleBorderWindow"
  Background="{DynamicResource {x:Static nuget:Brushes.BackgroundBrushKey}}"
  Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}"
  WindowStartupLocation="CenterOwner"
  Title="{Binding Title}"
  Height="500"
  Width="500">
  <Window.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <nuget:SharedResources />
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </Window.Resources>

  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition
        Height="auto" />
      <RowDefinition
        Height="auto" />
      <RowDefinition />
      <RowDefinition
        Height="auto" />
    </Grid.RowDefinitions>
    <TextBlock
      Grid.Row="0"
      Margin="12,8,12,0"
      Text="{x:Static nuget:Resources.Text_ReviewChanges}"
      FontSize="{Binding ElementName=_self,Path=FontSize,Converter={StaticResource Font122PercentSizeConverter}}" />

    <TextBlock
      Grid.Row="1"
      Margin="12,4,12,0"
      TextWrapping="Wrap"
      Text="{x:Static nuget:Resources.Text_Changes}" />

    <Border
      Grid.Row="2"
      Margin="12,12"
      BorderBrush="{DynamicResource {x:Static nuget:Brushes.BorderBrush}}"
      BorderThickness="1">
      <ScrollViewer
        HorizontalScrollBarVisibility="Auto"
        Background="{DynamicResource {x:Static nuget:Brushes.ContentBrushKey}}"
        IsTabStop="True">
        <ItemsControl
          ItemsSource="{Binding Path=PreviewResults}"
          IsTabStop="False">
          <ItemsControl.ItemTemplate>
            <DataTemplate>
              <StackPanel
                Margin="6, 6">
                <TextBlock
                  FontSize="{Binding ElementName=_self,Path=FontSize,Converter={StaticResource Font122PercentSizeConverter}}"
                  Text="{Binding Path=Name}" />

                <!-- Uninstalled packages -->
                <StackPanel
                  Margin="0,8"
                  Visibility="{Binding Path=Deleted,Converter={StaticResource EnumerableToVisibilityConverter}}">
                  <TextBlock
                    FontWeight="Bold"
                    Text="{x:Static nuget:Resources.Label_UninstalledPackages}" />
                  <ItemsControl
                    Margin="10,0,0,0"
                    ItemsSource="{Binding Path=Deleted}"
                    IsTabStop="False">
                  </ItemsControl>
                </StackPanel>

                <!-- Updated packages -->
                <StackPanel
                  Margin="0,8"
                  Visibility="{Binding Path=Updated,Converter={StaticResource EnumerableToVisibilityConverter}}">
                  <TextBlock
                    FontWeight="Bold"
                    Text="{x:Static nuget:Resources.Label_UpdatedPackages}" />
                  <ItemsControl
                    Margin="10,0,0,0"
                    ItemsSource="{Binding Path=Updated}"
                    IsTabStop="False">
                  </ItemsControl>
                </StackPanel>

                <!-- Installed packages -->
                <StackPanel
                  Margin="0,8"
                  Visibility="{Binding Path=Added,Converter={StaticResource EnumerableToVisibilityConverter}}">
                  <TextBlock
                    FontWeight="Bold"
                    Text="{x:Static nuget:Resources.Label_InstalledPackages}" />
                  <ItemsControl
                    Margin="10,0,0,0"
                    ItemsSource="{Binding Path=Added}"
                    IsTabStop="False">
                  </ItemsControl>
                </StackPanel>
              </StackPanel>
            </DataTemplate>
          </ItemsControl.ItemTemplate>
        </ItemsControl>
      </ScrollViewer>
    </Border>

    <Grid
      Grid.Row="3">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="auto" />
        <ColumnDefinition />
        <ColumnDefinition
          Width="auto" />
        <ColumnDefinition
          Width="auto" />
      </Grid.ColumnDefinitions>
      <CheckBox
        x:Name="_doNotShowCheckBox"
        Grid.Column="0"
        Margin="12"
        MinWidth="180"
        VerticalAlignment="Center"
        Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}"
        Content="{x:Static nuget:Resources.DoNotShowThisAgain}"
        Checked="DoNotShowCheckBox_Checked"
        Unchecked="DoNotShowCheckBox_Unchecked" />
      <Button
        Grid.Column="2"
        MinWidth="86"
        MinHeight="24"
        Margin="0,12"
        AutomationProperties.AutomationId="OK"
        Content="{x:Static nuget:Resources.Button_OK}"
        Click="OkButtonClicked" />
      <Button
        Grid.Column="3"
        MinWidth="86"
        MinHeight="24"
        Margin="6,12,12,12"
        AutomationProperties.AutomationId="Cancel"
        Content="{x:Static nuget:Resources.Button_Cancel}"
        Click="CancelButtonClicked" />
    </Grid>
  </Grid>
</nuget:VsDialogWindow>