Error "Parent grid cannot be null" when expanding child

4 posts, 0 answers
  1. Peter Meinl
    Peter Meinl avatar
    35 posts
    Member since:
    Jan 2010

    Posted 03 Feb 2010 Link to this post

    I am trying to display hierarchical data from a WCF Data Service.
    This works fine with the WPF grid. With the Silverlight version I have the following problem.

    This Grid displays the Parent Data with fine.
    When clicking on the + to expand a child grid a ge the error
    System.ArgumentNullException: Parent grid cannot be null
    Parameter name: parentGridViewDataControlPeer
       at Telerik.Windows.Controls.GridView.Automation.GridViewCellAutomationPeer..ctor(GridViewCell owner, GridViewDataControlAutomationPeer parentGridViewDataControlPeer)
       at Telerik.Windows.Controls.GridView.GridViewCell.OnCreateAutomationPeer()
       at System.Windows.UIElement.GetOrCreateAutomationPeer()
       at System.Windows.UIElement.OnCreateAutomationPeer(IntPtr nativeTarget, IntPtr& returnAP)

     

     

     

    Imports RadControlsSilverlightApplication1.ServiceReference1  
    Imports System.Data.Services.Client  
    Imports Telerik.Windows.Controls  
     
    Partial Public Class MainPage  
        Inherits UserControl  
        Dim ctx As New NorthwindEntities(New Uri("http://localhost:11702/WebDataService1.svc/"))  
     
        Public Sub New()  
            InitializeComponent()  
     
            Dim td As New GridViewTableDefinition()  
            td.Relation = New Telerik.Windows.Data.PropertyRelation("Orders")  
            radGridView.ChildTableDefinitions.Add(td)  
        End Sub 
     
        Private Sub ShowButton_Click(ByVal sender As ObjectByVal e As System.Windows.RoutedEventArgs) Handles ShowButton.Click  
            ShowData()  
        End Sub 
     
        Private Sub ShowData()  
            Dim query As DataServiceQuery(Of Customers) = ctx.Customers.Expand("Orders")  
            query.BeginExecute(AddressOf RequestCompleted, query)  
        End Sub 
     
        Private Sub RequestCompleted(ByVal asyncResult As IAsyncResult)  
            Dim query As DataServiceQuery(Of Customers) = TryCast(asyncResult.AsyncState, DataServiceQuery(Of Customers))  
            Dim customers = query.EndExecute(asyncResult).ToList()  
            Me.radGridView.ItemsSource = customers  
        End Sub 
    End Class 

    <UserControl xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"  xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"  x:Class="RadControlsSilverlightApplication1.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" d:DesignWidth="640" d:DesignHeight="480">  
         <Grid x:Name="LayoutRoot">  
            <StackPanel> 
             <telerik:RadButton x:Name="ShowButton" Content="Show"</telerik:RadButton> 
             <telerikGridView:RadGridView x:Name="radGridView"/>  
            </StackPanel> 
      </Grid> 
    </UserControl> 

  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Feb 2010 Link to this post

    Hello Peter,

    Can you post more info about the grid version?

    Regards,
    Vlad
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. DevCraft banner
  4. Peter Meinl
    Peter Meinl avatar
    35 posts
    Member since:
    Jan 2010

    Posted 04 Feb 2010 Link to this post

    The version is: RadControls_for_Silverlight4_2009_3_1314_TRIAL

    I have zero experience with Silverlight, so this could be a very simple bug in my code.
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Feb 2010 Link to this post

    Hello Peter,

    Can you send us this project (via support ticket)? I will gladly help you to find what is going on!

    Greetings,
    Vlad
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top