<UserControl x:Class="MasterDetailsWithRIAServices.AlbumsControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:my="clr-namespace:MasterDetailsWithRIAServices"
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
    xmlns:riaData="clr-namespace:System.Windows.Data;assembly=System.Windows.Controls.Ria"
    xmlns:services="clr-namespace:MasterDetailsWithRIAServices.Web.Services"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView">
	<Grid Name="LayoutRoot">
		
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<riaControls:DomainDataSource x:Name="albumsDataSource" 
									  AutoLoad="True" 
									  QueryName="GetAlbumsForArtistIdQuery">
			<riaControls:DomainDataSource.QueryParameters>
				<riaControls:ControlParameter ControlName="albumsGrid" 
											  ParameterName="artistId" 
											  PropertyName="DataContext.ArtistId"/>
			</riaControls:DomainDataSource.QueryParameters>
			<riaControls:DomainDataSource.DomainContext>
				<services:ChinookContext/>
			</riaControls:DomainDataSource.DomainContext>
		</riaControls:DomainDataSource>

		<TextBlock Grid.Row="0" Margin="2">Albums:</TextBlock>
		<telerik:RadGridView
                        Name="albumsGrid"
						MinHeight="100"
						MaxHeight="400"
						ItemsSource="{Binding ElementName=albumsDataSource, Path=Data}"
						IsBusy="{Binding ElementName=albumsDataSource, Path=IsBusy}"
                        Grid.Row="1"
                        Margin="2"
                        AutoGenerateColumns="False"
                        ColumnWidth="*"
                        ShowGroupPanel="False">
			<telerik:RadGridView.Columns>
				<telerik:GridViewDataColumn Header="Album Title" 
											DataMemberBinding="{Binding Title}"/>
			</telerik:RadGridView.Columns>
		</telerik:RadGridView>
		<Button Name="submitButton" 
				Margin="2"
				Grid.Row="2" 
				Content="Submit Changes" 
				Click="OnSubmitChanges" 
				Width="100"
				HorizontalAlignment="Stretch"/>
	</Grid>
</UserControl>
