Collection PropertyDescriptor binding to DataGridView - all rows show the same data
-
Hey, I searched everywhere but was unable to find a solution somewhere: I'm binding to a WinForms (2.0) DataGridView. When I bind to the List(Of MyType) (List in C#) it shows up just fine in the DataGridView. However MyType contains a List(Of MySubType) and I want each MySubType to appear as a column in the DataGridView. What I did was wrapping up MyType like "MyTypeDescriptor : ICustomTypeDescriptor" (Implements) which exposes each MySubType as a property (I also needed a "MySubTypePropertyDesc : PropertyDescriptor" (Inherits) for this). So I try to bind my new List(Of MyTypeDescriptor) to the DataGridView. What happens now is that the first row shows up correctly but all rows after that are a copy of the first one. Considerations: * The content of the List(Of MyTypeDescriptor) is correct. ie it contains the wrappers around the different MyType objects. * When I bind the different "MyTypeDescriptor" to PropertyGrids, they show the expected data. * I tried implementing the ITypedList but got the same incorrect result. Anyone has an idea what I am supposed to do here? Cheers, Wouter
-
Hey, I searched everywhere but was unable to find a solution somewhere: I'm binding to a WinForms (2.0) DataGridView. When I bind to the List(Of MyType) (List in C#) it shows up just fine in the DataGridView. However MyType contains a List(Of MySubType) and I want each MySubType to appear as a column in the DataGridView. What I did was wrapping up MyType like "MyTypeDescriptor : ICustomTypeDescriptor" (Implements) which exposes each MySubType as a property (I also needed a "MySubTypePropertyDesc : PropertyDescriptor" (Inherits) for this). So I try to bind my new List(Of MyTypeDescriptor) to the DataGridView. What happens now is that the first row shows up correctly but all rows after that are a copy of the first one. Considerations: * The content of the List(Of MyTypeDescriptor) is correct. ie it contains the wrappers around the different MyType objects. * When I bind the different "MyTypeDescriptor" to PropertyGrids, they show the expected data. * I tried implementing the ITypedList but got the same incorrect result. Anyone has an idea what I am supposed to do here? Cheers, Wouter
-
This was quite a while ago :) I finished the project but I have no idea what kind of workaround was required... At my current project we use Janus GridEx instead of the standard WinForms DataGrid(View) which is pretty neat. http://www.janusys.com/controls/