One of our dialogs contains an ultragrid having a couple of columns, one of them have the key "Path"
Although we the column is realy present in the collection, as we can confirm using the visual studio watch feature, the contains() method seem to fail:
if (genericDataGrid1.Grid.DisplayLayout.Bands[0].Columns.Contains("Path")) >>> returns false
//if (genericDataGrid1.Grid.ActiveRow.Cells.Contains("Path")) >>> returns also false
Thats why we did the following work around:
foreach (UltraGridCell cell in genericDataGrid1.Grid.ActiveRow.Cells)
{
if (cell.Column.Key == "Path")
//code to execute
Any idea
Best regards
Kagel
Contains searches the collection for an instances of that object in the list. Since the columns collection contains UltraGridColumn objects, Contains will never return true when you pass in a string, because there are no strings in this collection.
You should use the Exists method, instead, which searches the column Keys.