<Window 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:dialogs="clr-namespace:LibationAvalonia.Dialogs"
		xmlns:vm="clr-namespace:LibationUiBase;assembly=LibationUiBase"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
		Width="800" Height="450"
        x:Class="LibationAvalonia.Dialogs.FindBetterQualityBooksDialog"
		x:DataType="vm:FindBetterQualityBooksViewModel"
        Title="Scan Audible for Better Quality Audiobooks">

  <Grid Margin="5" RowDefinitions="*,Auto">
	  <DataGrid
		Name="booksDataGrid"
		GridLinesVisibility="All"
		CanUserReorderColumns="True"
		CanUserResizeColumns="True"
		CanUserSortColumns="True"
		AutoGenerateColumns="False"
		IsReadOnly="True"
		ItemsSource="{CompiledBinding Books}">
		  <DataGrid.Styles>
			  <Style x:DataType="vm:BookDataViewModel" Selector="DataGridRow">
				  	<Setter Property="Background" Value="{CompiledBinding ScanStatus, Converter={x:Static dialogs:FindBetterQualityBooksDialog.RowConverter }}" />
			  </Style>
		  </DataGrid.Styles>
		  <DataGrid.Columns>
			  
				<DataGridTextColumn
    				Width="120"
				    IsReadOnly="False"
				    Binding="{CompiledBinding Asin}"
				    Header="ASIN"/>

				<DataGridTextColumn
    				Width="120"
				    IsReadOnly="True"
				    Binding="{CompiledBinding Title}"
				    Header="Title"/>

				<DataGridTextColumn
    				Width="120"
				    IsReadOnly="True"
				    Binding="{CompiledBinding FoundFile}"
				    Header="Best Found File"/>

				<DataGridTextColumn
    				Width="90"
				    IsReadOnly="True"
				    Binding="{CompiledBinding Codec}"
				    Header="Existing&#xa;Codec"/>

				<DataGridTextColumn
    				Width="90"
				    IsReadOnly="True"
					SortMemberPath="Bitrate"
				    Binding="{CompiledBinding BitrateString}"
				    Header="Existing&#xa;Bitrate"/>

				<DataGridTextColumn
    				Width="90"
				    IsReadOnly="True"
				    Binding="{CompiledBinding AvailableCodec}"
				    Header="Available&#xa;Codec"/>

				<DataGridTextColumn
    				Width="90"
				    IsReadOnly="True"
					SortMemberPath="AvailableBitrate"
				    Binding="{CompiledBinding AvailableBitrateString}"
				    Header="Available&#xa;Bitrate"/>

			  <DataGridCheckBoxColumn
    				Width="90"
				    IsReadOnly="True"
					Binding="{CompiledBinding IsSignificant}"
				    Header="Significantly&#xa;Greater?"/>

          </DataGrid.Columns>
      </DataGrid>
	  <Grid Margin="0,5,0,0" Grid.Row="1"
		 ColumnDefinitions="Auto,Auto,*,Auto">
		  
		  <CheckBox IsChecked="{Binding ScanWidevine, Mode=TwoWay}" Content="{x:Static vm:FindBetterQualityBooksViewModel.UseWidevineSboxText }" Margin="0,0,5,0" />

		  <Button Name="scanBtn" IsEnabled="False" Grid.Column="1" Classes="SaveButton" Content="{Binding ScanButtonText}" Click="Scan_Click" />

		  <TextBlock Grid.Column="2" VerticalAlignment="Center" Text="{Binding ScanCount}" Margin="10,0,0,0" />
		  <Button Grid.Column="3" Classes="SaveButton" Content="{Binding MarkBooksButtonText}"
			IsVisible="{Binding SignificantCount}" Click="MarkBooks_Click" />
	  </Grid>
  </Grid>
</Window>
