<Window x:Class="MVVM_Sample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:MVVM_Sample.ViewModel"
        Name="mainWindow"
        Title="MVVM_Sample3" Height="400" Width="550">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources\NavigationButtons.xaml" />
                <ResourceDictionary Source="Resources\AnzeigeTextboxen.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <local:MainViewModel x:Key="vm" />
        </ResourceDictionary>
    </Window.Resources>

    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF7C7985" Offset="0"/>
            <GradientStop Color="White" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>

    <Grid DataContext="{StaticResource vm}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <DockPanel Grid.Row="0" Height="24" Background="LightGray" LastChildFill="False">
            <Button Command="{Binding FirstCommand}" Template="{StaticResource navFirst}" Margin="3" />
            <Button Command="{Binding PreviousCommand}" Template="{StaticResource navPrevious}" Margin="3" />
            <TextBox Width="150" Text="{Binding ActualPosition, Mode=OneWay}"/>
            <Button Command="{Binding NextCommand}" Template="{StaticResource navNext}" Margin="3" />
            <Button Command="{Binding LastCommand}" Template="{StaticResource navLast}" Margin="3" />
            <ComboBox DockPanel.Dock="Right" Width="140"/>
            <Label Margin="0 0 10 0" DockPanel.Dock="Right" FontSize="12" Padding="0" VerticalAlignment="Center">Sortierung:</Label>
        </DockPanel>

        <ListView ItemsSource="{Binding PersonsView, Mode=OneWay}" Grid.Row="1" SelectionMode="Single" Name="listView" Margin="3 5 3 10">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="" Width="20" />
                    <GridViewColumn DisplayMemberBinding="{Binding LastName}" Header="LastName" Width="100" />
                    <GridViewColumn DisplayMemberBinding="{Binding FirstName}" Header="FirstName" Width="100" />
                    <GridViewColumn DisplayMemberBinding="{Binding BirthDate}" Header="BirthDate" Width="100" />
                    <GridViewColumn DisplayMemberBinding="{Binding City}" Header="City" Width="100" />
                </GridView>
            </ListView.View>
        </ListView>

        <Grid Grid.Row="2" DataContext="{Binding SelectedItem, ElementName=listView}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Label Grid.Row="0" Grid.Column="0">FirstName:</Label>
                <Label Grid.Row="1" Grid.Column="0">LastName:</Label>
                <Label Grid.Row="2" Grid.Column="0">City:</Label>
                <Label Grid.Row="3" Grid.Column="0">BirthDate:</Label>
                <TextBox Text="{Binding FirstName}" Name="txtFirstName" Grid.Row="0" Grid.Column="1" />
                <TextBox Text="{Binding LastName}" Name="txtLastName" Grid.Row="1" Grid.Column="1" />
                <TextBox Text="{Binding City}" Name="txtCity" Grid.Row="2" Grid.Column="1" />
                <TextBox Text="{Binding BirthDate}" Name="txtBirthDate" Grid.Row="3" Grid.Column="1" />
            </Grid>
            <Grid Name="gridInfo" Grid.Row="0" Grid.Column="2" Grid.RowSpan="4" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Label Grid.Row="0">Details:</Label>
                <TextBox Name="txtDetailInformation" Grid.Row="1" TextWrapping="Wrap" />
            </Grid>
        </Grid>

        <StackPanel Grid.Row="3" Orientation="Horizontal">
            <Button Width="80" Margin="5 12 0 5"
                    Command="ApplicationCommands.New" Content="{Binding Text, Source={x:Static ApplicationCommands.New}}" />
            <Button Width="80" Margin="8 12 0 5"
                    Command="ApplicationCommands.Save" Content="{Binding Text,Source={x:Static ApplicationCommands.Save}}"/>
            <Button Width="80" Margin="8 12 0 5"
                    Command="ApplicationCommands.Delete" Content="{Binding Text, Source={x:Static ApplicationCommands.Delete}}"/>
            <Button Width="80" Margin="8 12 0 5" 
                    Command="ApplicationCommands.Undo" Content="{Binding Text, Source={x:Static ApplicationCommands.Undo}}" />
        </StackPanel>
    </Grid>
</Window>

