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

GridView throws "Unable to cast object of type 'TypeA' to type 'TypeB'"

0 Answers 58 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anton
Top achievements
Rank 1
Anton asked on 13 Aug 2012, 08:33 AM
Hi,
I use GridView in following scenario:
(meta code)

Model:
SomeCollection<TypeA>
-SomeCollection<TypeB>

XAML:
<RadGridView ItemSource = {Binding SomeCollection<TypeA>}>
<RowTemplate>
<RadGridView ItemSource = {Binding SomeCollection<TypeB>}/> 
</RowTemplate> 
</RadGridView> 

Problem:
When first level GridView has grouping, during modifying the SomeCollection<TypeB> - exception will be thrown:
System.InvalidCastException: Unable to cast object of type 'TypeA' to type 'TypeB'.
Trace:
at Telerik.Windows.Data.FuncExtensions+<>c__DisplayClass1`2[T,TResult].<ToUntypedFunc>b__0 (Object item) (IL offset: 0x0)
at Telerik.Windows.Controls.GridView.GridViewDataControl.GenerateScrollingStack (Object dataItem) (IL offset: 0x66)
at Telerik.Windows.Controls.GridView.GridViewDataControl+<>c__DisplayClass89.<ScrollIntoViewAsync>b__88 () (IL offset: 0x0)

I have to say, this defect exists pretty long time, for 2-3 releases

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Anton
Top achievements
Rank 1
Share this question
or