Databinding Question

Databinding Question

Old forum URL: forums.lhotka.net/forums/t/1844.aspx


mr_lasseter posted on Monday, November 27, 2006

I having a problem with databinding. Hopefully someone can help with a solution.

My Csla Classes are:
Invoice (Editable Root)
 --> SubInvoiceCollection (Editable Collection)
   --> SubInvoice (Editable Child)
     --> InvoiceDetailCollection (Editable Collection)
       --> InvoiceDetail (Editable Child)

The InvoiceDetail Class contains an amount field which is editable.  Any changes to the amount field should be propagated to the InvoiceDetailCollection, which I have done using the Observer pattern.  The InvoiceDetailCollection is responsible for notify the SubInvoice that its CalculatedAmount has changed, which I have also done using the Observer pattern.  The SubInvoice contains a readonly property that exposes the InvoiceDetailCollection.CalculatedAmount.  So when the SubInvoice class receives notification from InvoiceDetailCollection it calls PropertyHasChanged("CalculatedAmount").

On the UI I have this setup using parent - child databinding (each are displayed in 2 different DataGridviews).  This is all working correctly, when I update an amount in the InvoiceDetail Grid I see my changes appear in the SubInvoice Grid.  The problem is when the SubInvoice grid refreshes, the current selected cell of the InvoiceDetail Grid is moved to the first column.

Any advice on how to keep the cursor on the selected column?

Thanks,
Mike

Copyright (c) Marimer LLC