<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:windows="clr-namespace:Aaru.Gui.ViewModels.Windows"
        xmlns:controls="clr-namespace:Aaru.Gui.Controls"
        xmlns:localization="clr-namespace:Aaru.Localization;assembly=Aaru.Localization"
        mc:Ignorable="d"
        d:DesignWidth="800"
        d:DesignHeight="450"
        x:Class="Aaru.Gui.Views.Windows.DeviceList"
        x:DataType="windows:DeviceListViewModel"
        Height="250"
        Width="775"
        Title="{x:Static localization:UI.Title_Device_list}">
    <Design.DataContext>
        <windows:DeviceListViewModel />
    </Design.DataContext>
    <Grid RowDefinitions="Auto,*, Auto"
          RowSpacing="8"
          Margin="12">
        <Grid Grid.Row="0"
              ColumnDefinitions="Auto, *"
              ColumnSpacing="8"
              IsVisible="{Binding RemotePath, Converter={x:Static StringConverters.IsNotNullOrEmpty}, Mode=OneWay}">
            <controls:SpectreTextBlock Grid.Column="0"
                                       Text="{x:Static localization:UI.Title_AaruRemote_server}" />
            <TextBlock Grid.Column="1"
                       Foreground="Green"
                       Text="{Binding RemotePath, Mode=OneWay}" />
        </Grid>
        <DataGrid Grid.Row="1"
                  ItemsSource="{Binding Devices, Mode=OneWay}"
                  HorizontalAlignment="Stretch"
                  VerticalAlignment="Stretch"
                  HorizontalScrollBarVisibility="Visible"
                  SelectedItem="{Binding SelectedDevice, Mode=TwoWay}"
                  ColumnHeaderHeight="32">
            <DataGrid.Styles>
                <Style Selector="DataGridRow:nth-child(2n)">
                    <Setter Property="Background">
                        <SolidColorBrush Color="#15FFFFFF" />
                    </Setter>
                </Style>
                <Style Selector="DataGridRow:nth-child(2n):pointerover">
                    <Setter Property="Background"
                            Value="{DynamicResource SystemControlHighlightListLowBrush}" />
                </Style>
                <Style Selector="DataGridRow:nth-child(2n):selected">
                    <Setter Property="Background"
                            Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                </Style>
                <Style Selector="DataGridCell">
                    <Setter Property="Margin"
                            Value="4,0" />
                </Style>
            </DataGrid.Styles>
            <DataGrid.Columns>
                <DataGridTemplateColumn Width="Auto">
                    <DataGridTemplateColumn.HeaderTemplate>
                        <DataTemplate>
                            <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Path}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.HeaderTemplate>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Width="Auto">
                    <DataGridTemplateColumn.HeaderTemplate>
                        <DataTemplate>
                            <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Vendor}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.HeaderTemplate>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Vendor, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Width="Auto">
                    <DataGridTemplateColumn.HeaderTemplate>
                        <DataTemplate>
                            <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Model}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.HeaderTemplate>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Model, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Width="Auto">
                    <DataGridTemplateColumn.HeaderTemplate>
                        <DataTemplate>
                            <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Serial_number}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.HeaderTemplate>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Serial, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Width="Auto">
                    <DataGridTemplateColumn.HeaderTemplate>
                        <DataTemplate>
                            <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Bus}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.HeaderTemplate>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Bus, Mode=OneWay}"
                                       VerticalAlignment="Center" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Width="Auto">
                    <DataGridTemplateColumn.HeaderTemplate>
                        <DataTemplate>
                            <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Supported}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.HeaderTemplate>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Supported, Mode=OneWay}"
                                      IsEnabled="False" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
        <StackPanel Grid.Row="2"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right"
                    Spacing="8">
            <Button Command="{Binding OpenDeviceCommand, Mode=OneWay}">
                <TextBlock Text="{x:Static localization:UI.Title_Open_device}" />
            </Button>
        </StackPanel>
    </Grid>
</Window>