This question is locked. New answers and comments are not allowed.
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)
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 Object, ByVal 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> |