A few reasons:
- Your observablecollection needs to be public.
Your observablecollection should be a property.
public class MyClass {
public ObservableCollection<MyItem> myList {get; set;} public MyClass() { DataContext=this; myList = new ObservableCollection(); myList.Add(new MyItem() { Text = "Abkhazia" }); myList.Add(new MyItem() { Text = "Afghanistan" }); myList.Add(new MyItem() { Text = "Albania" }); }
}
Also keep in mind if your modifying "MyItem" it needs to support INotifyPropertyChanged or your display will NOT update.