<nuget:VsDialogWindow
  x:Class="NuGet.PackageManagement.UI.LicenseAcceptanceWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:nuget="clr-namespace:NuGet.PackageManagement.UI"
  x:Name="_self"
  MinWidth="450"
  MinHeight="450"
  Width="450"
  Height="450"
  Background="{DynamicResource {x:Static nuget:Brushes.BackgroundBrushKey}}"
  Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}"
  mc:Ignorable="d"
  ShowInTaskbar="False"
  WindowStartupLocation="CenterOwner"
  KeyDown="OnButtonKeyDown"
  Title="{x:Static nuget:Resources.WindowTitle_LicenseAcceptance}"
  d:DesignHeight="300"
  d:DesignWidth="300">
  <Window.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <nuget:SharedResources />
      </ResourceDictionary.MergedDictionaries>
      <DataTemplate
        x:Key="LicenseItemTemplate">
        <StackPanel
          Margin="2,0,2,5">
          <TextBlock
            TextWrapping="Wrap">
                    <Run
              Text="{Binding Id, Mode=OneTime}"
              FontWeight="Bold" />
                    <Run
              Text=" " />
                    <Run
              Text="{x:Static nuget:Resources.Label_Authors}" />
                    <Run
              Text="{Binding Authors, Mode=OneTime}" />
          </TextBlock>
          <TextBlock
            AutomationProperties.AutomationId="{Binding Id, Mode=OneWay, StringFormat='LicenseTerm_{0}'}">
                    <Hyperlink
              AutomationProperties.AutomationId="{Binding Id, Mode=OneWay, StringFormat='LicenseTermLink_{0}'}"
              NavigateUri="{Binding LicenseUrl, Mode=OneTime}"
              Style="{StaticResource HyperlinkStyle}"
              RequestNavigate="OnViewLicenseTermsRequestNavigate">
                        <Run
                Text="{x:Static nuget:Resources.Text_ViewLicense}" />
                    </Hyperlink>
          </TextBlock>
        </StackPanel>
      </DataTemplate>
    </ResourceDictionary>
  </Window.Resources>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition
        Height="Auto" />
      <RowDefinition
        Height="Auto" />
      <RowDefinition />
      <RowDefinition
        Height="Auto" />
      <RowDefinition
        Height="Auto" />
    </Grid.RowDefinitions>
    <TextBlock
      Grid.Row="0"
      Margin="12,8,12,0"
      Text="{x:Static nuget:Resources.Text_LicenseAcceptance}"
      FontSize="{Binding ElementName=_self,Path=FontSize,Converter={StaticResource Font122PercentSizeConverter}}" />

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

    <ItemsControl
      Grid.Row="2"
      Margin="12,8"
      MinHeight="130"
      IsTabStop="False"
      ItemsSource="{Binding}"
      ItemTemplate="{StaticResource LicenseItemTemplate}">
      <ItemsControl.Template>
        <ControlTemplate
          TargetType="{x:Type ItemsControl}">
          <Border
            BorderThickness="1"
            BorderBrush="{DynamicResource {x:Static nuget:Brushes.BorderBrush}}">
            <ScrollViewer
              Padding="3"
              Background="{DynamicResource {x:Static nuget:Brushes.ContentBrushKey}}"
              CanContentScroll="True"
              VerticalScrollBarVisibility="Visible"
              HorizontalScrollBarVisibility="Disabled">
              <ItemsPresenter></ItemsPresenter>
            </ScrollViewer>
          </Border>
        </ControlTemplate>
      </ItemsControl.Template>
    </ItemsControl>
    <TextBlock
      Grid.Row="3"
      Margin="12,0,12,12"
      Text="{x:Static nuget:Resources.Text_LicenseText}"
      TextWrapping="Wrap"></TextBlock>

    <Grid
      Grid.Row="5">
      <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition
          Width="auto" />
        <ColumnDefinition
          Width="auto" />
      </Grid.ColumnDefinitions>

      <Button
        Grid.Column="1"
        MinWidth="86"
        MinHeight="24"
        Margin="0,12"
        Content="{x:Static nuget:Resources.Button_IAccept}"
        AutomationProperties.AutomationId="AcceptButton"
        Click="OnAcceptButtonClick" />
      <Button
        Grid.Column="2"
        MinWidth="86"
        MinHeight="24"
        Margin="6,12,12,12"
        Content="{x:Static nuget:Resources.Button_IDecline}"
        AutomationProperties.AutomationId="DeclineButton"
        Click="OnDeclineButtonClick" />
    </Grid>
  </Grid>
</nuget:VsDialogWindow>