Hi,
Can any one tell me y contain method of ValueListItem does not work. I am trying to find a valuelistitem using
this
.ultraGrid2.DisplayLayout.ValueLists[MyValueList].ValueListItems.Contains(v1) where v1 is ValueListItem but it always gives me false.
While the same works fine if add any new valuelistitem and then try to find it.
ValueListItem.Remove() also works fine but not contain().
Please Help.
I am also having a problem with the Infragistics ValueListItems.Contains method not working.
If I run the following code, after having added a ValueListItem called 'Test' - If grdData.DisplayLayout.ValueLists.Contains("Test") ..., this return False
If I then try to add it again - grdData.DisplayLayout.ValueLists.Add("Test") - I get an error stating the key already exists.
Can you provide an example of how this should work?
Thanks
Andrew Hunot
The only explanation I can think of is that the item is not in the collection. The Contains method will do a reference comparison, so if you create a ValueListItem instance with the same DataValue and DisplayText as one that exists in the collection, and pass that into the Contains method, it should not and does not return true since they are two different instances.