Home Forums WinForms controls Xceed Grid for WinForms DetailGrid and IList

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14881 |

    In the documentation of the Grid it is said, that the DataSource property of the GridControl and of the DetailGrid can be any component that implements the IList interface.

    For the GridControl there is no problem, but for the DetailGrid. I bind a IList of an own type to the GridControl. This class has a property (in example: Adresses), that is a IList of another own type. Now I want to bind this IList to the DetailGrid:

    Xceed.Grid.DetailGrid dgSub = new Xceed.Grid.DetailGrid();
    dgSub.DataSource = dgMain.DataSource;
    dgSub.DataMember = “Addresses”;
    dgMain.DetailGridTemplates.Add(dgSub);

    In the last line a GridInternalException is raised with the following message: “Impossible to bind the grid to the specified data source and member.”

    If I do the same thing and change the type of the “Adresses” property to List (to do that, I have to repack the whole list), then there is no problem anymore.

    Imported from legacy forums. Posted by cmeyer1984 (had 2210 views)

    User (Old forums)
    Member
    Post count: 23064

    The problem comes from the fact that IList<> does not implement IList, so it returns a List, and the grid does not support this binding.

    You need to use List<>, which implements IList, which the grid supports.

    Imported from legacy forums. Posted by André (had 2381 views)

    User (Old forums)
    Member
    Post count: 23064

    Same problem here but with the master grid … any luck to this problem ????

    What do you meant by ‘change the type of the “Adresses” property to List ‘

    Imported from legacy forums. Posted by Credits (had 662 views)

    User (Old forums)
    Member
    Post count: 23064

    He meant changing the class to which he binds form IList interface to List type.

    IList<> is an interface, whereas List<> is a typed list (class) that implements the IList<> interface (among others).

    http://msdn.microsoft.com/en-us/library/system.collections.ilist.aspx

    http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx

     

     

    Imported from legacy forums. Posted by André (had 877 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.