C
Carmine Moleti
Hi to everyone,
I've faced, and found a workaround, for the following problem:
1. Having a collection of objects implemented through BindingList<OrderRow>
2. OrderRow implements INotifyPropertyChanged to track changes to
properties, in particular to the quantity one.
The collection is bound to a ListBox via BindingSource.
When I add/remove items from the collection, the listbox gets updated
the correct way.
If I add the same objects multiple times to the collection the listbox
updates _only_ the quantity of the object displayed on the first row!
E.g.:
Nr. 1 - My first row
Nr. 1 - My second row
Adding another 1 quantity of "My first row" produces:
Nr. 2 - My first row
Nr. 1 - My second row
This holds true for each quantity of "My first row" added.
Adding another 1 quantity of "My second row" produces:
Nr. 2 - My first row
Nr. 1 - My second row
During debug I found the quantities gets updated correctly in the
collection.
Also, after struggling, found that replacing the listbox with a datagrid
solved the problem.
What's wrong with ListBox?
Thanks for your help.
Regards,
Carmine
I've faced, and found a workaround, for the following problem:
1. Having a collection of objects implemented through BindingList<OrderRow>
2. OrderRow implements INotifyPropertyChanged to track changes to
properties, in particular to the quantity one.
The collection is bound to a ListBox via BindingSource.
When I add/remove items from the collection, the listbox gets updated
the correct way.
If I add the same objects multiple times to the collection the listbox
updates _only_ the quantity of the object displayed on the first row!
E.g.:
Nr. 1 - My first row
Nr. 1 - My second row
Adding another 1 quantity of "My first row" produces:
Nr. 2 - My first row
Nr. 1 - My second row
This holds true for each quantity of "My first row" added.
Adding another 1 quantity of "My second row" produces:
Nr. 2 - My first row
Nr. 1 - My second row
During debug I found the quantities gets updated correctly in the
collection.
Also, after struggling, found that replacing the listbox with a datagrid
solved the problem.
What's wrong with ListBox?
Thanks for your help.
Regards,
Carmine