<Window x:Class="FahrzeugVerwaltung.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Fahrzeugverwaltung" Height="700" Width="1000"
        WindowStartupLocation="CenterScreen">

    <Window.Resources>
        <Style TargetType="Button">
            <Setter Property="Background" Value="#FF007ACC"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="BorderBrush" Value="#FF005A9B"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="10,5"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#FF005A9B"/>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="TextBox">
            <Setter Property="Padding" Value="5"/>
            <Setter Property="BorderBrush" Value="#FFCCCCCC"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Height" Value="25"/>
        </Style>

        <Style TargetType="GroupBox">
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Foreground" Value="#FF333333"/>
        </Style>
    </Window.Resources>

    <Grid Margin="10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="400"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <GroupBox Grid.Column="0" Grid.Row="0" Header="Neues Fahrzeug" Margin="5">
            <Grid Margin="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Label Grid.Row="0" Grid.Column="0" Content="Marke:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="0" Grid.Column="1" Name="txtMarke" Margin="5"/>

                <Label Grid.Row="1" Grid.Column="0" Content="Modell:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="1" Grid.Column="1" Name="txtModell" Margin="5"/>

                <Label Grid.Row="2" Grid.Column="0" Content="Baujahr:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="2" Grid.Column="1" Name="txtBaujahr" Margin="5"/>

                <Label Grid.Row="3" Grid.Column="0" Content="Leistung (PS):" VerticalAlignment="Center"/>
                <TextBox Grid.Row="3" Grid.Column="1" Name="txtLeistung" Margin="5"/>

                <Label Grid.Row="4" Grid.Column="0" Content="Kilometerstand:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="4" Grid.Column="1" Name="txtKilometer" Margin="5"/>

                <Label Grid.Row="5" Grid.Column="0" Content="Kaufpreis (€):" VerticalAlignment="Center"/>
                <TextBox Grid.Row="5" Grid.Column="1" Name="txtKaufpreis" Margin="5"/>

                <Label Grid.Row="6" Grid.Column="0" Content="Farbe:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="6" Grid.Column="1" Name="txtFarbe" Margin="5"/>

                <Button Grid.Row="7" Grid.Column="1" Name="btnSpeichern" Content="Speichern" 
                        Margin="5" HorizontalAlignment="Right" Width="120" Height="35"
                        Click="BtnSpeichern_Click"/>
            </Grid>
        </GroupBox>
        <GroupBox Grid.Column="1" Grid.Row="0" Header="Fahrzeuge suchen" Margin="5">
            <StackPanel Margin="10" Orientation="Horizontal">
                <Label Content="Suchbegriff:" VerticalAlignment="Center"/>
                <TextBox Name="txtSuche" Width="200" Margin="5"/>
                <Button Name="btnSuchen" Content="Suchen" Width="80" Height="30" Margin="5"
                        Click="BtnSuchen_Click"/>
                <Button Name="btnAlle" Content="Alle anzeigen" Width="100" Height="30" Margin="5"
                        Click="BtnAlle_Click"/>
            </StackPanel>
        </GroupBox>
        <GroupBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Header="Fahrzeuge" Margin="5">
            <Grid Margin="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <DataGrid Grid.Row="0" Name="dgFahrzeuge" AutoGenerateColumns="False" 
                          IsReadOnly="True" SelectionMode="Single" Margin="10,10,0,28"
                          SelectionChanged="DgFahrzeuge_SelectionChanged" Grid.RowSpan="2">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Marke" Binding="{Binding Marke}" Width="100"/>
                        <DataGridTextColumn Header="Modell" Binding="{Binding Modell}" Width="120"/>
                        <DataGridTextColumn Header="Baujahr" Binding="{Binding Baujahr}" Width="80"/>
                        <DataGridTextColumn Header="Leistung" Binding="{Binding Leistung}" Width="80"/>
                        <DataGridTextColumn Header="Kilometer" Binding="{Binding KilometerstandFormatiert}" Width="100"/>
                        <DataGridTextColumn Header="Kaufpreis" Binding="{Binding KaufpreisFormatiert}" Width="100"/>
                        <DataGridTextColumn Header="Farbe" Binding="{Binding Farbe}" Width="80"/>
                        <DataGridTextColumn Header="Aktueller Wert" Binding="{Binding AktuellerWertFormatiert}" Width="120"/>
                    </DataGrid.Columns>
                </DataGrid>

                <TextBlock Grid.Row="1" Name="txtDetails" Margin="5" FontWeight="Bold" FontSize="14"
                           Text="Kein Fahrzeug ausgewählt" HorizontalAlignment="Center"/>

                <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="10">
                    <Button Name="btnPdf" Content="Als PDF speichern" Width="150" Height="35" 
                            Margin="5" IsEnabled="False" Click="BtnPdf_Click"/>
                    <Button Name="btnAktualisieren" Content="Aktualisieren" Width="120" Height="35" 
                            Margin="5" Click="BtnAktualisieren_Click"/>
                </StackPanel>
            </Grid>
        </GroupBox>
    </Grid>
</Window>