<Window x:Class="SharepointToolbox.Views.Dialogs.SitePickerDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Select Sites" Width="600" Height="500"
        WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
        Loaded="Window_Loaded">
  <Grid Margin="12">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <!-- Filter row -->
    <DockPanel Grid.Row="0" Margin="0,0,0,8">
      <TextBlock Text="Filter:" VerticalAlignment="Center" Margin="0,0,8,0" />
      <TextBox x:Name="FilterBox" TextChanged="FilterBox_TextChanged" />
    </DockPanel>

    <!-- Site list with checkboxes -->
    <ListView x:Name="SiteList" Grid.Row="1" Margin="0,0,0,8"
              SelectionMode="Single"
              BorderThickness="1" BorderBrush="#CCCCCC">
      <ListView.View>
        <GridView>
          <GridViewColumn Header="" Width="32">
            <GridViewColumn.CellTemplate>
              <DataTemplate>
                <CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                          HorizontalAlignment="Center" />
              </DataTemplate>
            </GridViewColumn.CellTemplate>
          </GridViewColumn>
          <GridViewColumn Header="Title" Width="200" DisplayMemberBinding="{Binding Title}" />
          <GridViewColumn Header="URL" Width="320" DisplayMemberBinding="{Binding Url}" />
        </GridView>
      </ListView.View>
    </ListView>

    <!-- Status text -->
    <TextBlock x:Name="StatusText" Grid.Row="2" Margin="0,0,0,8"
               Foreground="#555555" FontSize="11" />

    <!-- Button row -->
    <DockPanel Grid.Row="3">
      <Button x:Name="LoadButton" Content="Load Sites" Width="80" Margin="0,0,8,0"
              Click="LoadButton_Click" />
      <Button Content="Select All" Width="80" Margin="0,0,8,0"
              Click="SelectAll_Click" />
      <Button Content="Deselect All" Width="80" Margin="0,0,8,0"
              Click="DeselectAll_Click" />
      <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Right">
        <Button Content="OK" Width="70" Margin="4,0" IsDefault="True"
                Click="OK_Click" />
        <Button Content="Cancel" Width="70" Margin="4,0" IsCancel="True" />
      </StackPanel>
    </DockPanel>
  </Grid>
</Window>
