<controls:ChildWindow x:Class="RadGridViewCrash.GridHost"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    Title="GridHost"
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" 
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
    mc:Ignorable="d" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:my="clr-namespace:RadGridViewCrash.Web.Models">
        <Grid x:Name="LayoutRoot" Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
        <Border x:Name="SearchBorder" BorderThickness="1" BorderBrush="Silver" Padding="10" Margin="15,0" Grid.Row="0">
            <Grid Name="SearchGrid">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <!--<ColumnDefinition Width="Auto" />-->
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <TextBlock Text="Search:" Grid.Column="0" Grid.Row="0" Padding="15,5" />
                    <TextBox Name="txtSearch" Grid.Column="1" Grid.Row="0" />
                    <!--<Button Name="btnSearch" Grid.Column="2" Grid.Row="0" Content="Search" Padding="15,5" Margin="15,0,0,0" Click="btnSearch_Click" />-->
                </Grid>
        </Border>
        <Grid Grid.Row="1">
            <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:CompanySearchResult, CreateList=true}" Height="0" LoadedData="companySearchResultDomainDataSource_LoadedData" Name="companySearchResultDomainDataSource" QueryName="GetEntity_CompanySearchResultQuery" Width="0">
                <riaControls:DomainDataSource.DomainContext>
                    <my:TestDomainContext />
                </riaControls:DomainDataSource.DomainContext>
            </riaControls:DomainDataSource>
            <telerik:RadGridView x:Name="RadGridView1" ItemsSource="{Binding ElementName=companySearchResultDomainDataSource, Path=Data}" Margin="15,2"
						  RowIndicatorVisibility="Collapsed" IsReadOnly="True" AutoGenerateColumns="False" CanUserFreezeColumns="False" 
						  CanUserResizeColumns="True" Height="300">
                <telerik:RadGridView.RowStyle>
                    <Style TargetType="telerik:GridViewRow">
                        <Setter Property="MinHeight" Value="40"/>
                    </Style>
                </telerik:RadGridView.RowStyle>
                <telerik:RadGridView.Columns>
                    <!--<telerik:GridViewToggleRowDetailsColumn />-->
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=CompanyName}" Header="Company Name" />
                    <!--Width="SizeToCells" MinWidth="110"-->
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Address}" Header="Address" />
                    <!--Width="SizeToHeader" MinWidth="60"-->
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=ZipCode}" Header="Zip Code" />
                    <!-- Width="SizeToHeader" MinWidth="70" -->
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=City}" Header="City" />
                    <!-- Width="SizeToHeader" MinWidth="45" -->
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Country}" Header="Country" />
                    <!--  Width="SizeToCells" MinWidth="65" -->
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=ParentCompanyID}" Header="Parent Company ID" />
                    <!-- Width="SizeToHeader" -->
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=ChildCompanies}" Header="Child Companies" />
                    <!-- Width="SizeToHeader" -->
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </Grid>
        <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="2" />
        <Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="2" DataContext="{Binding}" />
        </Grid>
</controls:ChildWindow>