This is a migrated thread and some comments may be shown as answers.

Q3 Nested Hierarchy Exception

1 Answer 30 Views
GridView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 24 Nov 2009, 09:03 AM

Hello,

I'm attempting to migrate my code to Q3 (2009.3.1120.1030) and have struck an exception when loading a nested hierarchy.

In Q2 I used event PreviewDataRecordCreate to build up the relationships but I see this has been marked obsolete, so I'm now using the suggested RowLoaded event.

First, here is a code snippet used within the RowLoaded event:
 

                    GridViewTableDefinition detailDefinition = new GridViewTableDefinition();  
                    detailDefinition.Relation = new PropertyRelation("OrderDetail");  
                    e.GridViewDataControl.ChildTableDefinitions.Add(detailDefinition); 


The last line throws this excpetion:

{System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.Collection_Clear[T](PresentationFrameworkCollection`1 collection)
   at System.Windows.PresentationFrameworkCollection`1.ClearImpl()
   at System.Windows.PresentationFrameworkCollection`1.Clear()
   at Telerik.Windows.Controls.GridView.GridViewBaseVirtualizingPanel.OnItemsChangedInternal(Object sender, ItemsChangedEventArgs args)
   at Telerik.Windows.Controls.GridView.GridViewBaseVirtualizingPanel.OnItemsChangedHandler(Object sender, ItemsChangedEventArgs args)
   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.OnRefresh()
   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.Refresh()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.childTables_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.TableDefinitionCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at SLTraderShellPrototype.OpenPositionsGrid.radGridViewPropertyHierarchy_RowLoaded(Object sender, RowLoadedEventArgs e)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnRowLoaded(RowLoadedEventArgs e)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.RaiseRowLoaded(GridViewRowItem row)
   at Telerik.Windows.Controls.GridView.GridViewRowItem.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)}

Help appreciated.

Regards,
James

1 Answer, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 26 Nov 2009, 11:53 AM
Hi James,

With Q3 you do not need to do that - just set IsExpandable to desired value for desired row. I've attached an example project for reference.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
James
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or