<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:m="using:SourceGit.Models"
             xmlns:vm="using:SourceGit.ViewModels"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="SourceGit.Views.DeleteMultipleBranches"
             x:DataType="vm:DeleteMultipleBranches">
  <StackPanel Orientation="Vertical" Margin="8,0">
    <StackPanel Orientation="Horizontal">
      <Path Width="16" Height="16"
            Data="{StaticResource Icons.Clear}"/>

      <TextBlock FontSize="18"
                 Margin="8,0,0,0"
                 Classes="bold"
                 Text="{DynamicResource Text.DeleteMultiBranch}"/>
    </StackPanel>

    <Border Margin="4,16,0,0"
            Background="{DynamicResource Brush.Contents}"
            BorderThickness="1"
            BorderBrush="{DynamicResource Brush.Border1}"
            CornerRadius="4"
            Padding="4">
      <ListBox MaxHeight="200"
               BorderThickness="0"
               Background="Transparent"
               ItemsSource="{Binding Targets}"
               SelectionMode="Single"
               ScrollViewer.HorizontalScrollBarVisibility="Auto"
               ScrollViewer.VerticalScrollBarVisibility="Auto">
        <ListBox.Styles>
          <Style Selector="ListBoxItem">
            <Setter Property="Margin" Value="0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Height" Value="26"/>
            <Setter Property="CornerRadius" Value="4"/>
          </Style>
        </ListBox.Styles>

        <ListBox.ItemsPanel>
          <ItemsPanelTemplate>
            <VirtualizingStackPanel Orientation="Vertical"/>
          </ItemsPanelTemplate>
        </ListBox.ItemsPanel>

        <ListBox.ItemTemplate>
          <DataTemplate DataType="m:Branch">
            <Grid Height="26" ColumnDefinitions="22,*,Auto">
              <Path Grid.Column="0" Width="10" Height="10" Margin="4,0,8,0" Data="{StaticResource Icons.Branch}" />
              <TextBlock Grid.Column="1" Text="{Binding FriendlyName}" />
              <Border Grid.Column="2"
                      Height="18"
                      Margin="8,0"
                      Padding="8,0"
                      VerticalAlignment="Center"
                      CornerRadius="9"
                      Background="{DynamicResource Brush.Badge}"
                      IsVisible="{Binding IsTrackStatusVisible}">
                <TextBlock Foreground="{DynamicResource Brush.BadgeFG}"
                           FontFamily="{DynamicResource Fonts.Monospace}"
                           FontSize="10"
                           Text="{Binding TrackStatusDescription, Mode=OneWay}"/>
              </Border>
            </Grid>
          </DataTemplate>
        </ListBox.ItemTemplate>
      </ListBox>
    </Border>

    <TextBlock Margin="4,8,0,0"
               Text="{DynamicResource Text.DeleteMultiBranch.Tip}"
               TextWrapping="Wrap"
               Foreground="{DynamicResource Brush.FG2}"
               FontStyle="Italic" />
  </StackPanel>
</UserControl>
