Donington

I have a problem that I use as itemssource of a listview a derived observable collection. The itemssource is visible in the listview but when I do a change of the collection like clear() or remove() it does not update the itemssource collection. The update of the item content itself does work.

Does someone know where the problem is

I'm using this derived observable collection:

public class CLS_RunItemList : ObservableCollection<CLS_RunItem>

{

}

The Item definiton looks like this:

public class CLS_RunItem : INotifyPropertyChanged

{

string sRunNumber;

/// <summary>

/// Event called if a property is changed.

/// </summary>

public event PropertyChangedEventHandler PropertyChanged;

public CLS_RunItem(string sRunNumber)

{

RunNumber = sRunNumber;

}

public string RunNumber

{

get

{

return sRunNumber;

}

set

{

sRunNumber = value;

if (PropertyChanged != null)

{

PropertyChanged(this, new PropertyChangedEventArgs("RunNumber"));

}

}

}

}

}

In the constructor of the listview I set the derived observablecollection to the itemssource:

ctlRunList.ItemsSource = RunItemList;



Re: Windows Presentation Foundation (WPF) Derived Observable Collection does not update the itemcollection in a listview when items added or removed

Zhou Yong

I cannot reproduce this problem on my side, how do you add / remove / clear the source collection

and which source collection do you manipulate against






Re: Windows Presentation Foundation (WPF) Derived Observable Collection does not update the itemcollection in a listview when items added or removed

Donington

Hi

I do a add (Items.Add(runItem)) or clear on the derived observable collection. This class I instantiate in another class as I have the listview.

I've a simple testproject I maybe can send you.

Thanks Thomas





Re: Windows Presentation Foundation (WPF) Derived Observable Collection does not update the itemcollection in a listview when items added or removed

Zhou Yong

Hi Donington,

You can send the test project to me at footballism at gmail dot com.






Re: Windows Presentation Foundation (WPF) Derived Observable Collection does not update the itemcollection in a listview when items added or removed

Donington

Hi Zhou Yong

I sent the project to your email adress. Did you get it