<Window x:Class="dealer.MainWindow"
    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:dealer"
    mc:Ignorable="d"
    Title="Evidence vozidel - Autobazar" Height="450" Width="800">
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!-- Nadpis -->
        <TextBlock Grid.Row="0"
            Text="Evidence vozidel"
            FontSize="24"
            FontWeight="Bold"
            Margin="0,0,0,10"
            HorizontalAlignment="Center" />

        <!-- ListView s vozidly -->
        <ListView Grid.Row="1"
            Name="VehiclesListView"
            Margin="0,0,0,10"
            MouseDoubleClick="VehiclesListView_MouseDoubleClick">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="SPZ" Width="120" DisplayMemberBinding="{Binding Spz}" />
                    <GridViewColumn Header="Značka a Model" Width="200"
                        DisplayMemberBinding="{Binding ZnackaModel}" />
                    <GridViewColumn Header="Barva" Width="130">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <Border Width="20" Height="20" BorderBrush="Gray" BorderThickness="1" Margin="0,0,8,0">
                                        <Border.Background>
                                            <SolidColorBrush Color="{Binding Barva}" />
                                        </Border.Background>
                                    </Border>
                                    <TextBlock Text="{Binding Barva}" VerticalAlignment="Center" />
                                </StackPanel>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="Rok" Width="70" DisplayMemberBinding="{Binding RokVyroby}" />
                    <GridViewColumn Header="Palivo" Width="100" DisplayMemberBinding="{Binding Palivo}" />
                </GridView>
            </ListView.View>
        </ListView>

        <!-- Tlacitka -->
        <StackPanel Grid.Row="2"
            Orientation="Horizontal"
            HorizontalAlignment="Center">
            <Button Name="AddButton"
                Content="Pridat vozidlo"
                Width="120"
                Height="35"
                Margin="5"
                FontSize="14"
                Click="AddButton_Click" />
            <Button Name="DetailButton"
                Content="Detail"
                Width="100"
                Height="35"
                Margin="5"
                FontSize="14"
                Click="DetailButton_Click" />
            <Button Name="EditButton"
                Content="Upravit"
                Width="100"
                Height="35"
                Margin="5"
                FontSize="14"
                Click="EditButton_Click" />
            <Button Name="DeleteButton"
                Content="Smazat"
                Width="100"
                Height="35"
                Margin="5"
                FontSize="14"
                Click="DeleteButton_Click" />
            <Button Name="OwnersButton"
                Content="Vlastnici"
                Width="100"
                Height="35"
                Margin="5"
                FontSize="14"
                Background="#FFE0E0FF"
                Click="OwnersButton_Click" />
        </StackPanel>
    </Grid>
</Window>