Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Collection PropertyDescriptor binding to DataGridView - all rows show the same data

Collection PropertyDescriptor binding to DataGridView - all rows show the same data

Scheduled Pinned Locked Moved Windows Forms
csharpwpfwinformswcfquestion
3 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Laoujin
    wrote on last edited by
    #1

    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

    G 1 Reply Last reply
    0
    • L Laoujin

      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

      G Offline
      G Offline
      gbarrett
      wrote on last edited by
      #2

      Wouter, Did you get an answer? I'm having the exact same issue! Thanks!

      L 1 Reply Last reply
      0
      • G gbarrett

        Wouter, Did you get an answer? I'm having the exact same issue! Thanks!

        L Offline
        L Offline
        Laoujin
        wrote on last edited by
        #3

        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/

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups