I have different classes inherited from one Interface, all of them are added into a OberservableCollection. Could someone explain me how to assign all values of Observablecollection to my Listbox, except of class b.
Suppose (edit):
private void start()
{
DP = new MyClass();
this.ListBox.ItemsSource = new ObservableCollection<WInstance>(MyClass.Handler.Instances.OfType<WInstance>());
}
...
class Handler() : INotifyPropertyChanged
{
public ObservableCollection<HandlerItem> Instances { get; private set; }
...
}
class HandlerItem: INotifyPropertyChanged
{
public Instance inst { get; private set; } //Instance could be WInstance or CInstance
}
During runtime MyClass receive from remote-Computer some objects of WInstance or CInstance. if i try to solve it with Instances.OfType() it seems that my ItemsSource wount be updated
1 Answer