We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

AddNew - IBindingList

Thread ID:

Created:

Updated:

Platform:

Replies:

37968 Dec 2,2005 03:45 PM Dec 3,2005 06:39 AM Windows Forms 2
loading
Tags: GridControl
Martin Cyr
Asked On December 2, 2005 03:45 PM

I''m having some problems with my IBindingList again. Sometimes, when I set the grids datasource to my collection, I cannot add new items to the collection, but when I bind it to the same collection but with items in it, it works nicely. Even if I remove every item from my collection, it works, I can still add things. But if my collection is plain new when I datasource the grid to it, then no way I can add new elements: the blank line is there but no call to my collection addNew function is made, I can select data from a combo column (datasourced to some other data), but then, the grid doesn''t add another blank line for a new entry, and whenever I move currentcell, the data entered disapears.

Martin Cyr
Replied On December 2, 2005 04:23 PM

In case my explanation would be confusing or unclear, here is a sample illustrating the behaviour that I described. Just comment the second For loop in the Form1_Load to see the problem. P.S. We''re using SF Essential Studio 3.301.0.0

IBindingListDemo.zip

Administrator [Syncfusion]
Replied On December 3, 2005 06:39 AM

Thanks for the sample. When your list is empty, then grid needs to be able to get at the type of the objects in the list in order to initialize the associated property descriptors properly. In your collection, you added an attribute to indicate the type of the object in the collection. But Essential Grid does not look for this type of attribute. Instead, it relies on the collection implementing ITypedList to enable it to handle empty lists as datasources. So, I was able to get you sample working by adding Implements System.ComponentModel.ITypedList and
    Public Function GetItemProperties(ByVal listAccessors() As System.ComponentModel.PropertyDescriptor) As System.ComponentModel.PropertyDescriptorCollection Implements System.ComponentModel.ITypedList.GetItemProperties
        Return System.ComponentModel.TypeDescriptor.GetProperties(GetType(Blah))
    End Function

    Public Function GetListName(ByVal listAccessors() As System.ComponentModel.PropertyDescriptor) As String Implements System.ComponentModel.ITypedList.GetListName
        Return "Blah"
    End Function
to your collection class.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;