<controls:ChildWindow 
    xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm" 
	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:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
	mc:Ignorable="d"
	xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" xmlns:System="clr-namespace:System;assembly=mscorlib"
	xmlns:local="clr-namespace:SilverlightDataApp"
	x:Class="SilverlightDataApp.Registration">

    <Grid x:Name="LayoutRoot" Height="Auto" Width="600">
        <!--Define the rows of the grid. This is used to position the UI elements properly inside the window. 
        The second row's height is set to 10 instead of auto, so that we get a little space between the DataForm and the Submit / Cancel buttons-->
        <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
                <RowDefinition Height="Auto"/>
         </Grid.RowDefinitions>
        
        <!--Define a new dataform here. The AutoEdit property is set to True, so that when displayed, the form is ready to accept new data. 
        User cannot delete any items, and the fields are not auto generated, but defined manually.--> 
		<dataControls:DataForm x:Name="MyDataForm" 
			AutoGenerateFields="False"
			CommandButtonsVisibility="None"
			CanUserDeleteItems="False" 
			AutoEdit="True"  
			AutoCommit="False" d:LayoutOverrides="Height" >   
            <!--The DataForm's fields are defined here with the corresponding bindings to the database-->
			<dataControls:DataForm.Fields>
				<dataControls:DataFormTextField FieldLabelContent="Eesnimi: " Binding="{Binding Mode=TwoWay, Path=eesnimi}" />
				<dataControls:DataFormTextField FieldLabelContent="Perenimi: " Binding="{Binding Mode=TwoWay, Path=perenimi}" />
                <dataControls:DataFormTextField FieldLabelContent="Vanus: " Binding="{Binding Mode=TwoWay, Path=vanus}" />
				<dataControls:DataFormTextField FieldLabelContent="Eriala: " Binding="{Binding Mode=TwoWay, Path=eriala}" />
				<dataControls:DataFormTextField FieldLabelContent="Kursus: " Binding="{Binding Mode=TwoWay, Path=kursus}" />
			</dataControls:DataForm.Fields>
		</dataControls:DataForm>

        <!--The Submit / Cancel buttons are defined here-->
		<Button x:Name="CancelButton" Content="Loobu" Click="CancelButton_Click" HorizontalAlignment="Right" d:LayoutOverrides="HorizontalAlignment, GridBox" Width="90" Height="23" VerticalAlignment="Bottom" Margin="0,0,200,0" Grid.Row="2" />
		<Button x:Name="OKButton" Content="Registreeru" Click="OKButton_Click" HorizontalAlignment="Left" d:LayoutOverrides="HorizontalAlignment, GridBox" Width="90" Height="23" VerticalAlignment="Bottom" Margin="200,0,0,0" Grid.Row="2" />
	</Grid>
</controls:ChildWindow>