<UserControl x:Class="WpfApp99.UserControlA"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:WpfApp99"
			 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
			 mc:Ignorable="d"
			 d:DesignHeight="450" d:DesignWidth="800">

	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="pack://application:,,,/WpfApp99;component/ResourceTemplate.xaml" />
			</ResourceDictionary.MergedDictionaries>
			<local:DataContextProxy x:Key="DataContextProxy" Data="{Binding}"/>

		</ResourceDictionary>
	</UserControl.Resources>
	
    <Grid>
		<Grid.RowDefinitions>
			<RowDefinition/>
			<RowDefinition/>
			<RowDefinition/>
		</Grid.RowDefinitions>
		
		<TextBlock Grid.Row="0" Text="UserControl A" FontSize="50" HorizontalAlignment="Center"/>
		
		<telerik:RadGridView Grid.Row="1" ItemsSource="{Binding GridViewA}" Width="300" Height="200" AutoGenerateColumns="False" ShowSearchPanel="False">
				<telerik:RadGridView.Columns>
				<telerik:GridViewDataColumn Header="Title" Width="60" DataMemberBinding="{Binding Title}"/>
					
					<telerik:GridViewColumn Header="Action" Width="120" HeaderTextAlignment="Center" TextAlignment="Center">
						<telerik:GridViewColumn.CellTemplate>
							<DataTemplate>
							<StackPanel Orientation="Horizontal">
								<telerik:RadButton	Content="A" Width="45"
													Command="{Binding Data.OnClickAinA, Source={StaticResource DataContextProxy}}"
													CommandParameter="{Binding}" />
								<telerik:RadButton	Content="B" Width="45" Margin="15 0 0 0"
													Command="{Binding DataContext.OnClickAinB, RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}"
													CommandParameter="{Binding}" />
							</StackPanel>
							</DataTemplate>
						</telerik:GridViewColumn.CellTemplate>
					</telerik:GridViewColumn>
				</telerik:RadGridView.Columns>
			</telerik:RadGridView>
	</Grid>
</UserControl>
