<window:StyleableWindow
    x:Class="Ryujinx.Ava.UI.Windows.DownloadableContentManagerWindow"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:window="clr-namespace:Ryujinx.Ava.UI.Windows"
    Width="800"
    Height="500"
    MinWidth="800"
    MinHeight="500"
    MaxWidth="800"
    MaxHeight="500"
    SizeToContent="Height"
    WindowStartupLocation="CenterOwner"
    mc:Ignorable="d"
    Focusable="True">
    <Grid Name="DownloadableContentGrid" Margin="15">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <TextBlock
            Name="Heading"
            Grid.Row="1"
            MaxWidth="500"
            Margin="20,15,20,20"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            LineHeight="18"
            TextAlignment="Center"
            TextWrapping="Wrap" />
        <DockPanel
            Grid.Row="2"
            Margin="0"
            HorizontalAlignment="Left">
            <Button
                Name="EnableAllButton"
                MinWidth="90"
                Margin="5"
                Command="{Binding EnableAll}">
                <TextBlock Text="{locale:Locale DlcManagerEnableAllButton}" />
            </Button>
            <Button
                Name="DisableAllButton"
                MinWidth="90"
                Margin="5"
                Command="{Binding DisableAll}">
                <TextBlock Text="{locale:Locale DlcManagerDisableAllButton}" />
            </Button>
        </DockPanel>
        <Border
            Grid.Row="3"
            Margin="5"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch"
            BorderBrush="Gray"
            BorderThickness="1">
            <ScrollViewer
                VerticalAlignment="Stretch"
                HorizontalScrollBarVisibility="Auto"
                VerticalScrollBarVisibility="Auto">
                <DataGrid
                    Name="DlcDataGrid"
                    MinHeight="200"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    CanUserReorderColumns="False"
                    CanUserResizeColumns="True"
                    CanUserSortColumns="True"
                    HorizontalScrollBarVisibility="Auto"
                    Items="{Binding _downloadableContents}"
                    SelectionMode="Extended"
                    VerticalScrollBarVisibility="Auto">
                    <DataGrid.Styles>
                        <Styles>
                            <Style Selector="DataGridCell:nth-child(3), DataGridCell:nth-child(4)">
                                <Setter Property="HorizontalAlignment" Value="Left" />
                                <Setter Property="HorizontalContentAlignment" Value="Left" />
                            </Style>
                        </Styles>
                        <Styles>
                            <Style Selector="DataGridCell:nth-child(1)">
                                <Setter Property="HorizontalAlignment" Value="Right" />
                                <Setter Property="HorizontalContentAlignment" Value="Right" />
                            </Style>
                        </Styles>
                    </DataGrid.Styles>
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Width="90">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <CheckBox
                                        Width="50"
                                        MinWidth="40"
                                        HorizontalAlignment="Center"
                                        IsChecked="{Binding Enabled}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                            <DataGridTemplateColumn.Header>
                                <TextBlock Text="{locale:Locale DlcManagerTableHeadingEnabledLabel}" />
                            </DataGridTemplateColumn.Header>
                        </DataGridTemplateColumn>
                        <DataGridTextColumn Width="140" Binding="{Binding TitleId}">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{locale:Locale DlcManagerTableHeadingTitleIdLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Width="280" Binding="{Binding FullPath}">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{locale:Locale DlcManagerTableHeadingFullPathLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding ContainerPath}">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{locale:Locale DlcManagerTableHeadingContainerPathLabel}" />
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </ScrollViewer>
        </Border>
        <DockPanel
            Grid.Row="4"
            Margin="0"
            HorizontalAlignment="Stretch">
            <DockPanel Margin="0" HorizontalAlignment="Left">
                <Button
                    Name="AddButton"
                    MinWidth="90"
                    Margin="5"
                    Command="{Binding Add}">
                    <TextBlock Text="{locale:Locale SettingsTabGeneralAdd}" />
                </Button>
                <Button
                    Name="RemoveButton"
                    MinWidth="90"
                    Margin="5"
                    Command="{Binding RemoveSelected}">
                    <TextBlock Text="{locale:Locale SettingsTabGeneralRemove}" />
                </Button>
                <Button
                    Name="RemoveAllButton"
                    MinWidth="90"
                    Margin="5"
                    Command="{Binding RemoveAll}">
                    <TextBlock Text="{locale:Locale DlcManagerRemoveAllButton}" />
                </Button>
            </DockPanel>
            <DockPanel Margin="0" HorizontalAlignment="Right">
                <Button
                    Name="SaveButton"
                    MinWidth="90"
                    Margin="5"
                    Command="{Binding SaveAndClose}">
                    <TextBlock Text="{locale:Locale SettingsButtonSave}" />
                </Button>
                <Button
                    Name="CancelButton"
                    MinWidth="90"
                    Margin="5"
                    Command="{Binding Close}">
                    <TextBlock Text="{locale:Locale InputDialogCancel}" />
                </Button>
            </DockPanel>
        </DockPanel>
    </Grid>
</window:StyleableWindow>