<Window x:Class="BuechermarktClient.BooksEdit"
        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:BuechermarktClient"
        mc:Ignorable="d"
        Title="Buch" Height="360" Width="300">
    <Window.Resources>
        <local:StringConverter x:Key="StringConverter"/>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        
        <StackPanel Grid.Column="0">
            <Label Content="Buch LabelId" Margin="10,0"></Label>
            <TextBox Margin="10,0" Text="{Binding Path=LabelId, Mode=TwoWay}" IsEnabled="{Binding New}"></TextBox>
            <Label Content="Buch Typ:" Margin="10,0"></Label>
            <Grid Margin="10,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBox Margin="0,0,5,0" Text="{Binding Path=BookTypeISBN, Mode=TwoWay}"></TextBox>
                <Button Grid.Column="1" Width="20" Click="SelectBookType_Click" Content="S" Height="20" VerticalAlignment="Top"></Button>
            </Grid>
            <Label Content="Schüler LabelId:" Margin="10,0"></Label>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBox Margin="10,0,5,0" Text="{Binding Path=StudentLabelId, Mode=TwoWay}"></TextBox>
                <Button Grid.Column="1" Width="20" Margin="0,0,10,0" Click="SelectStudent_Click" Content="S"/>
            </Grid>
            <Label Content="Preis:" Margin="10,0"></Label>
            <TextBox Margin="10,0" Text="{Binding Path=Price, Mode=TwoWay, Converter={StaticResource StringConverter}}"></TextBox>
            <Label Content="Status:" Margin="10,0"></Label>
            <ComboBox Margin="10,0" SelectedItem="{Binding Path=ComboState, Mode=TwoWay}" SelectedValue="{Binding Name}" Name="StateComboBox" DisplayMemberPath="Name"></ComboBox>
            <Grid Margin="10,10,10,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button Grid.Column="0" Content="Speichern" Click="Save_Click" Margin="0,0,5,0"></Button>
                <Button Grid.Column="1" Content="Löschen" Click="Delete_Click" Margin="5,0,0,0"></Button>
            </Grid>
        </StackPanel>
        <StackPanel Grid.Column="1">
            <GroupBox Header="Buch Typ" VerticalAlignment="Top">
                <StackPanel>
                    <Label Content="Name:" Margin="10,0"/>
                    <TextBox Text="{Binding Path=BookType.Name, Mode=OneWay}" Margin="10,0" IsEnabled="False"></TextBox>
                    <Label Content="ISBN:" Margin="10,0"></Label>
                    <TextBox Text="{Binding Path=BookType.ISBN, Mode=OneWay}" Margin="10,0" IsEnabled="False"></TextBox>
                    <Button Content="Details" Margin="10,10,10,0" Click="BookTypeDetails_Click"></Button>
                </StackPanel>
            </GroupBox>
            <GroupBox Header="Schüler" VerticalAlignment="Top">
                <StackPanel>
                    <Label Content="Name:" Margin="10,0"/>
                    <TextBox Margin="10,0" IsEnabled="False">
                        <TextBox.Text>
                            <MultiBinding StringFormat="{}{0}, {1}">
                                <Binding Path="Student.Lastname"></Binding>
                                <Binding Path="Student.Forname"></Binding>
                            </MultiBinding>
                        </TextBox.Text>
                    </TextBox>
                    <Label Content="Klasse:" Margin="10,0"></Label>
                    <TextBox Text="{Binding Path=Student.Form, Mode=OneWay}" Margin="10,0" IsEnabled="False"></TextBox>
                    <Label Content="E-Mail:" Margin="10,0"></Label>
                    <TextBox Text="{Binding Path=Student.EMail, Mode=OneWay}" Margin="10,0" IsEnabled="False"></TextBox>
                    <Button Content="Details" Margin="10,10,10,0" Click="StudentDetails_Click"></Button>
                </StackPanel>
            </GroupBox>
        </StackPanel>
    </Grid>
</Window>
