<Window x:Class="NBAManagment.MachupList"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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:local="clr-namespace:NBAManagment"
        mc:Ignorable="d"
        Title="Matchup List" Height="450" Width="800">
    <Window.Resources>
        <Style TargetType="ListView" x:Key="matchupListStyle">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Items.Count}"
                             Value="0">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <TextBlock Text="No matchups at this date." Margin="10" TextAlignment="Center"
                                           FontSize="20px"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="TextBlock">
        </Style>
        <Style TargetType="ListViewItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListViewItem">
                        <Border BorderBrush="Gray" BorderThickness="0, 0, 0, 2" Margin="10, 0">
                            <ContentPresenter/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="TextBlock" x:Key="statusTextBlock">
            <Setter Property="Margin" Value="5, 7"/>
            <Setter Property="Width" Value="125"/>
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="17"/>
            <Setter Property="TextAlignment" Value="Center"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="Padding" Value="7"/>
            <Style.Triggers>
                <Trigger Property="Text" Value="Finished">
                    <Setter Property="Background" Value="Gray"/>
                </Trigger>
                <Trigger Property="Text" Value="Running">
                    <Setter Property="Background" Value="Red"/>
                </Trigger>
                <Trigger Property="Text" Value="Not Start">
                    <Setter Property="Background" Value="LightBlue"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="120"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10, 30, 0, 0">
            <Button Name="previousDateButton" Height="20" Width="25" Content="&lt;" Background="White" FontSize="13px" Margin="3"/>
            <DatePicker Name="gameDatePicker" HorizontalAlignment="Center" VerticalAlignment="Center" Width="111"/>
            <Button Name="nextDateButton"  Height="20" Width="25" Content="&gt;" Background="White" FontSize="13px" Margin="3"/>
        </StackPanel>

        <StackPanel x:Name="nearestDateContainer" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
            <Image Source="{Binding TeamAwayNavigation.Logo}" Width="120" Height="80"/>
            <StackPanel Width="100" Margin="5">
                <TextBlock Margin="5, 5 , 5, 0"/>
                <TextBlock Text="(Away)" Margin="5, 0 , 5, 5"/>
            </StackPanel>
            <StackPanel Width="100" Margin="20, 0">
                <TextBlock Text="VS" HorizontalAlignment="Center" FontSize="36" Margin="15"/>
                <TextBlock Text="{Binding Starttime, StringFormat={}{0:hh:mm}}" TextAlignment="Center"/>
            </StackPanel>
            <StackPanel Width="100" Margin="5">
                <TextBlock Margin="5, 5 , 5, 0"/>
                <TextBlock Text="(Home)"
                           Margin="5, 0 , 5, 5"/>
            </StackPanel>
            <Image Source="{Binding TeamHomeNavigation.Logo}" Width="80" Height="80"/>
        </StackPanel>
        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0, 2, 0, 0">
            <DataGrid Name="DataGridMachup" AutoGenerateColumns="False" IsReadOnly="True">
                <DataGrid.Columns>
                    <DataGridTemplateColumn Header="Статус матча">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding IdStatusNavigation.StatusName}" Style="{StaticResource statusTextBlock}"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTextColumn Header="Время начала" Binding="{Binding Starttime, StringFormat={}{0:hh:mm}}"/>
                    <DataGridTemplateColumn Header="Команда гостей">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="{Binding TeamAwayNavigation.Logo}" Width="20" Height="20"/>
                                    <TextBlock Text="{Binding TeamAwayNavigation.Name}" Margin="5,0,0,0"/>
                                </StackPanel>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTextColumn Header="Счёт команды гостей" Binding="{Binding TeamAwayScore}"/>
                    <DataGridTextColumn Header="Счёт команды хозяев" Binding="{Binding TeamHomeScore}"/>
                    <DataGridTemplateColumn Header="Команда хозяев">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="{Binding TeamHomeNavigation.Logo}" Width="20" Height="20"/>
                                    <TextBlock Text="{Binding TeamHomeNavigation.Name}" Margin="5,0,0,0"/>
                                </StackPanel>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTextColumn Header="Местоположение" Binding="{Binding Location}"/>
                </DataGrid.Columns>
            </DataGrid>
        </Border>
    </Grid>
</Window>
