<UserControl x:Class="GridViewInDataForm.MainPage"
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:context="clr-namespace:GridViewInDataForm.Web"
xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
d:DesignHeight="300" d:DesignWidth="400">
	<Grid >
		<riaControls:DomainDataSource x:Name="customersDomainDataSource" LoadSize="100" QueryName="GetCustomersQuery" AutoLoad="True">
			<riaControls:DomainDataSource.DomainContext>
				<context:CustomersDomainContext />
			</riaControls:DomainDataSource.DomainContext>		
		</riaControls:DomainDataSource>
		<!--<riaControls:DomainDataSource x:Name="ordersDomainDataSource" QueryName="GetOrdersQuery" AutoLoad="True" >
			<riaControls:DomainDataSource.DomainContext>
				<context:CustomersDomainContext />
			</riaControls:DomainDataSource.DomainContext>
		</riaControls:DomainDataSource>-->
		
		<toolkit:DataForm   Name="DataFormcustomers" 
		Background="Beige" Width="1024" 
		CommandButtonsVisibility="Add, Cancel, Commit, Delete, Edit, Navigation" 
		ItemsSource= "{Binding Data,  ElementName=customersDomainDataSource}"
		AutoGenerateFields="False"  
		AutoCommit="False" 
		AutoEdit="False" 
		>
			<toolkit:DataForm.Header>
				<TextBlock Text="" FontSize="8"></TextBlock>
			</toolkit:DataForm.Header>
			<toolkit:DataForm.EditTemplate>
				<DataTemplate>
					<Grid ShowGridLines="True">
						<Grid.RowDefinitions>
							<RowDefinition Height="30" />
							<RowDefinition Height="30" />
							<RowDefinition Height="Auto"/>
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto"/>
							<ColumnDefinition Width="Auto"/>
							<ColumnDefinition Width="Auto"/>
						</Grid.ColumnDefinitions>
						<toolkit:DataField Grid.Row ="0" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Left">
							<TextBox Name="CustomerNo"  Text="{Binding CustomerID, Mode=TwoWay}" />
						</toolkit:DataField>
						<toolkit:DataField Grid.Row="0" Grid.Column="3" >
							<TextBox Name="CompanyName" Text="{Binding CompanyName, Mode=TwoWay}"  />
						</toolkit:DataField>
						<toolkit:DataField Grid.Row="14" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left">
							<telerik:RadGridView x:Name="RadGridViewOrders"  
							HorizontalAlignment="Right" Margin="0,0,20,0"  
							MaxHeight="350" Height="350"  Width="800" AutoGenerateColumns="False"
							ItemsSource="{Binding Orders}"
							IsBusy="False" ShowGroupPanel="False" SelectionMode="Extended"  CanUserDeleteRows="True" 
							CanUserInsertRows="True">
								<telerik:RadGridView.Columns>
									<telerik:GridViewSelectColumn>
									</telerik:GridViewSelectColumn>
									<telerik:GridViewDataColumn x:Name="OrderId" DataMemberBinding="{Binding OrderID, Mode=TwoWay}" >
									</telerik:GridViewDataColumn>
									<telerik:GridViewDataColumn x:Name="CustomerID" DataMemberBinding="{Binding CustomerID, Mode=TwoWay, NotifyOnValidationError=True,  ValidatesOnExceptions=True}" >
									</telerik:GridViewDataColumn>
									<telerik:GridViewDataColumn x:Name="ShipCity" DataMemberBinding="{Binding ShipCity, Mode=TwoWay, NotifyOnValidationError=True,  ValidatesOnExceptions=True}" >
									</telerik:GridViewDataColumn>
								</telerik:RadGridView.Columns>
							</telerik:RadGridView>
						</toolkit:DataField>
					</Grid>
				</DataTemplate>
			</toolkit:DataForm.EditTemplate>
		</toolkit:DataForm>		
	</Grid>
</UserControl>

	