<controls:ChildWindow
	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"
	mc:Ignorable="d"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:data="clr-namespace:System.Windows.Data;assembly=System.Windows.Ria.Controls" 
    xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm" 
    xmlns:ods="clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls" 
    xmlns:datagrid="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
    xmlns:swd="clr-namespace:System.Windows.Data;assembly=System.ComponentModel" 
    xmlns:dds="clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls"
    xmlns:activity="clr-namespace:System.Windows.Controls;assembly=ActivityControl"
    xmlns:App="clr-namespace:SilverlightDataApp.Web"
	x:Class="SilverlightDataApp.Registered">

    <Grid x:Name="LayoutRoot" Height="400" Width="600">
        <!--A new DomainDataSource is defined here. This is used throughout the application to the move data to and from the database.
        The data is set to autoload in batches of 20, since there is no point of pulling all the records at once.-->
        <dds:DomainDataSource x:Name="dds" 
          LoadMethodName="LoadRegTable"
          AutoLoad="True"
          LoadSize="20">
            <dds:DomainDataSource.DomainContext>
                <App:MyDomainContext></App:MyDomainContext>
            </dds:DomainDataSource.DomainContext>
        </dds:DomainDataSource>

            <!--An activity monitor is defined here. This gives us a nice visual progress bar, when the DataGrid is pulling records from the DataBase-->
            <activity:Activity IsActive="{Binding IsBusy, ElementName=dds}">
                <!--A new DataGrid is defined here. It is being bound to the DomainDataSource, is set to be read-only, 
                and the fields are specified manually. It is also possible to auto generate.-->
                <datagrid:DataGrid x:Name="RegisteredDataGrid" 
                   HorizontalAlignment="Stretch"
                   ItemsSource="{Binding Data, ElementName=dds}"   
                   AutoGenerateColumns="False"
                   IsReadOnly="True"
                   Height="400" Width="600">
                    <datagrid:DataGrid.Columns>
                        <datagrid:DataGridTextColumn Header="Eesnimi" Binding="{Binding eesnimi}" />
                        <datagrid:DataGridTextColumn Header="Perenimi" Binding="{Binding perenimi}" />
                        <datagrid:DataGridTextColumn Header="Vanus" Binding="{Binding vanus}" />
                        <datagrid:DataGridTextColumn Header="Eriala" Binding="{Binding eriala}" />
                        <datagrid:DataGridTextColumn Header="Kursus" Binding="{Binding kursus}" />
                    </datagrid:DataGrid.Columns>
                </datagrid:DataGrid>
            </activity:Activity>
    </Grid>
</controls:ChildWindow>