<UserControl x:Class="NuGet.PackageManagement.UI.OptionsControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:nuget="clr-namespace:NuGet.PackageManagement.UI"
             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"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="350">
  <UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <nuget:SharedResources />
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </UserControl.Resources>
  <UserControl.CommandBindings>
    <CommandBinding
      Command="{x:Static nuget:PackageManagerControlCommands.OpenExternalLink}"
      Executed="ExecuteOpenExternalLink" />
  </UserControl.CommandBindings>
  <Expander
    x:Name="_expander"
    Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}">
    <Expander.Header>
      <TextBlock
        Text="{x:Static nuget:Resources.Label_Options}"
        FontWeight="Bold" />
    </Expander.Header>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
      </Grid.RowDefinitions>

      <CheckBox
        Grid.Row="1"
        Margin="16,8,0,0"
        IsChecked="{Binding Path=Options.ShowPreviewWindow}"
        VerticalContentAlignment="Center"
        Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}"
        Content="{x:Static nuget:Resources.Checkbox_ShowPreviewWindow}" />

      <!-- install options -->
      <Grid Visibility="{Binding Options.ShowClassicOptions, Converter={StaticResource BooleanToVisibilityConverter}}"
          Grid.Row="2"
          Margin="16,16,0,0">
        <Grid.RowDefinitions>
          <RowDefinition Height="auto" />
          <RowDefinition Height="8" />
          <RowDefinition Height="auto" />
          <RowDefinition Height="8" />
          <RowDefinition Height="auto" />
          <RowDefinition Height="8" />
          <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="4*"/>
          <ColumnDefinition Width="*" MinWidth="30" />
        </Grid.ColumnDefinitions>
        <TextBlock
          Grid.Row="0"
          Grid.ColumnSpan="3"
          Margin="-16,0,0,0"
          Text="{x:Static nuget:Resources.GroupBoxHeader_InstallOptions}"
          FontWeight="Bold">
        </TextBlock>
        <TextBlock
          Grid.Row="2"
          Grid.Column="0"
          Margin="0,0,6,0"
          VerticalAlignment="Center"
          Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}"
          Text="{x:Static nuget:Resources.Label_DependencyBehavior}" />
        <ComboBox
          Grid.Row="2"
          Grid.Column="1"
          MinHeight="22"
          AutomationProperties.Name="{x:Static nuget:Resources.Label_DependencyBehavior}"
          ItemsSource="{Binding Path=Options.DependencyBehaviors}"
          SelectedItem="{Binding Path=Options.SelectedDependencyBehavior}" />

        <TextBlock
          Grid.Row="4"
          Grid.Column="0"
          Margin="0,0,6,0"
          VerticalAlignment="Center"
          Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}"
          Text="{x:Static nuget:Resources.Label_FileConflictAction}" />
        <ComboBox
          Grid.Row="4"
          Grid.Column="1"
          MinHeight="22"
          AutomationProperties.Name="{x:Static nuget:Resources.Label_FileConflictAction}"
          ItemsSource="{Binding Path=Options.FileConflictActions}"
          SelectedItem="{Binding Path=Options.SelectedFileConflictAction}" />

        <TextBlock Grid.Row="6" Grid.Column="0" TextWrapping="Wrap">
          <Hyperlink
            NavigateUri="http://docs.nuget.org/consume/package-manager-ui#install-options"
            Style="{StaticResource HyperlinkStyle}"
            Command="{x:Static nuget:PackageManagerControlCommands.OpenExternalLink}">
            <Run Text="{x:Static nuget:Resources.Link_LearnAboutInstallOptions}" />
          </Hyperlink>
        </TextBlock>
      </Grid>

      <!-- uninstall options -->
      <Grid Visibility="{Binding Options.ShowClassicOptions, Converter={StaticResource BooleanToVisibilityConverter}}"
          Grid.Row="3"
          Margin="16,16,0,0">
        <Grid.RowDefinitions>
          <RowDefinition Height="auto" />
          <RowDefinition Height="8" />
          <RowDefinition Height="auto" />
          <RowDefinition Height="8" />
          <RowDefinition Height="auto" />
          <RowDefinition Height="8" />
          <RowDefinition Height="auto" />
        </Grid.RowDefinitions>

        <TextBlock
          Grid.Row="0"
          Margin="-16,0,0,0"
          Text="{x:Static nuget:Resources.GroupBoxHeader_UninstallOptions}"
          FontWeight="Bold">
        </TextBlock>

        <CheckBox
          Grid.Row="2"
          IsChecked="{Binding Path=Options.RemoveDependencies}"
          VerticalContentAlignment="Center"
          Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}"
          Content="{x:Static nuget:Resources.Checkbox_RemoveDependencies}" />

        <CheckBox
          Grid.Row="4"
          IsChecked="{Binding Path=Options.ForceRemove}"
          VerticalContentAlignment="Center"
          Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}"
          Content="{x:Static nuget:Resources.Checkbox_ForceRemove}" />

        <TextBlock
          Grid.Row="6"
          TextWrapping="Wrap">
          <Hyperlink
            NavigateUri="http://docs.nuget.org/consume/package-manager-ui#uninstall-options"
            Style="{StaticResource HyperlinkStyle}"
            Command="{x:Static nuget:PackageManagerControlCommands.OpenExternalLink}">
            <Run Text="{x:Static nuget:Resources.Link_LearnAboutUninstallOptions}" />
          </Hyperlink>
        </TextBlock>
      </Grid>
    </Grid>
  </Expander>
</UserControl>