Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
459
MultiBand Displaying Bug w/Collection?
posted

I'm not sure if this is a bug or not, but here is the issue I am experiencing:  I am binding a custom collection to a grid but for bands more than two levels deep, no columns will display.

I am using a System.Collections.ObjectModel.Collection(Of T) class.  I am using it to store a simple class that looks like:

Imports System.Collections.ObjectModel Public Class Issue     Private _description As String    Private _childIssues As New Collection(Of Issue)     Public Property Description() As String        Get            Return Me._description        End Get        Set(ByVal value As String)            Me._description = value        End Set    End Property     Public ReadOnly Property ChildIssues() As Collection(Of Issue)        Get            Return Me._childIssues        End Get    End Property End Class

As you can see, the only interesting thing this class has is a reference to another collection that also contains Issues.

So say I have a form with a grid on it and then populate a collection with some Issue objects.  The grid will correctly display the first and second bands, but for the third band, it will show no columns and no rows - although it looks like something should be there (you can see the indicators and spacing where the columns should be).

Here is the code that populates and binds the collection.  There are three Issues in the collection: the first one has no children, the second one has one child, and the third one has one child that itself has a child.

Dim issues As New System.Collections.ObjectModel.Collection(Of Issue)Dim rootIssue As IssueDim childIssue As IssueDim child2Issue As Issue 'Root 1rootIssue = New Issue()rootIssue.Description = "Root Issue #1"issues.Add(rootIssue) 'Root 2rootIssue = New Issue()rootIssue.Description = "Root Issue #2"issues.Add(rootIssue) 'Root 2 Child 1childIssue = New Issue()childIssue.Description = "Root Issue #2/Child Issue #1"rootIssue.ChildIssues.Add(childIssue) 'Root 3rootIssue = New Issue()rootIssue.Description = "Root Issue #3"issues.Add(rootIssue) 'Root 3 Child 1childIssue = New Issue()childIssue.Description = "Root Issue #3/Child Issue #1"rootIssue.ChildIssues.Add(childIssue) 'Root 3 Child 1 Child 1child2Issue = New Issue()child2Issue.Description = "Root Issue #3/Child Issue #1/Child Issue #1"childIssue.ChildIssues.Add(child2Issue) Me.UltraGrid1.DataSource = issues

 

This will display the grid but there are no rows or column headers (the columns collection is empty in the band) for the Root3/Child/Child row - although it looks like something is there since it shows the indicator and has the spacing for it.

The thing is that adding the Root3 issue as the first issue in the collection (with its child and the child's child) will work.  It seems that the grid is just looking at the first item in the collection to determine 'how far down to go' for band displaying (but the databinding logic sort of works since it at least seems that it 'knows' something is really there).

Does anyone have any ideas on whether this is a bug or if there is a setting I could use to force the grid to determine how many bands to display?  I've tried every setting I could think of.  Binding to a DataSource or DataSet with a self-referencing table object bound to the grid at design-time and then populating it at run time works, but I would really like to associate the object in the collection with the grid and not have that intermediary (and I'm not quite sure how deep the collection will get - although realistically no more than five levels deep).

Thanks in advance for any pointers.

-David

Parents Reply Children