xal replied on Sunday, April 22, 2007
If I remember correctly, the binding source has an InnerList property (or something along those lines).
You can use that in order to get the actual list.
Also, you don't necessarily need to use the main binding source as datasource and specify a datamember. You can do this:
childBindingSource.DataSource = New SortedBindingList(Of Child)(mRootObject.ChildList)
As a last resort, you could create a property such as this inside your root object:
<NonSerialized(), NotUndoable()> _
Private m_SortedChildren As SortedBindingList(Of MyChild)
Public ReadOnly Property SortedChildren() As SortedBindingList(Of MyChild)
Get
If m_SortedChildren Is Nothing Then
m_SortedChildren = New SortedBindingList(Of MyChild)(Me.m_Children)
m_SortedChildren.ApplySort("SomeField", _
ComponentModel.ListSortDirection.Descending)
End If
Return m_SortedChildren
End Get
End Property
That way, you can use that "SortedChildren" property as a datamember and that would be it. This is particularily useful for grandchildren, where you'd have to reassign the granchild bindingsource's datasource whenever the "current child" changes...
Some could argue that this is suboptimal because these lists should be part of the ui, but hey, sometimes you just have to get the job done!!
Andrés