CF 2.0: INotifyPropertyChanged doesn't behave good with ListBox

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

Ilya Tumanov [MS]

For starters please try picking up NETCF SP1 which has updated
implementation for BindingList<T>.



I would also recommend you stick with data grid instead of listbox. Listbox
would make a copy of your entire data and is way slower.


http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=610234&SiteID=1

--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
C

Carmine Moleti

First off, thanks a lot Ilya!

I've downloaded the SP1, thanks!
I would also recommend you stick with data grid instead of listbox. Listbox
would make a copy of your entire data and is way slower.

Can you suggest me any book about CF (better if about 2.0), please?

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top