I encountered strange behavior of datagridview:
In the parent object (invoice) I have a childlist (invoiceitemlist) that I expose through a property like this:
Public ReadOnly Property InvoiceItemList() As Csla.SortedBindingList(Of InvoiceItem)
Adequate method in childlist is:
Private _SortedList As Csla.SortedBindingList(Of InvoiceItem) = Nothing
Public Function GetSortedList() As Csla.SortedBindingList(Of InvoiceItem)
If _SortedList Is Nothing Then _SortedList = New Csla.SortedBindingList(Of InvoiceItem)(Me)
Binding is implemented by VS GUI (draging form datasources).
I also have the same implementation (with private field) of exposing SBL in parentrootlist.
But in the first case databinding cancelnew method wouldn't work and in the second case it works perfectly. What could be a reason for that?
Don't expose the SBL as a property from your BO. Instead, wrap the property in a SBL before you bind it to the BindingSource. You'll have to write a bit of code to do this, but it should resolve your issue.
I implemented printing of BO by passing the object to the printing method. In order to support transfer of the sorting state (also filtering in some cases) of the object to the printing method the object itself should contain a reference to the actual sorted/filtered list. So wrapping the object on GUI side is not an option.
Besides I can't quite understand why can't I do it inside a property? What's the difference when doing the same thing on GUI side or BO side?
Copyright (c) Marimer LLC