[Solved] regarding ObservableCollection in c#

ObservableCollection implements INotifyPropertyChanged. This interface exposes events that allow consumers of your collection to be notified when the contents of the collection change. This is mainly used when binding in WPF, for example let’s say we have an ObservableCollection<string>: ObservableCollection<string> MyStrings { get { // return a collection with some strings here } } and … Read more

[Solved] WPF binding to custom class with observable collection

It sounds like you haven’t assigned your DataContext. Below is a brief example. Assuming your custom class looks something like this: CODE: public class Foo { private ObservableCollection<string> _names; public ObservableCollection<string> Names { get{ return _names;} set { _names = value; } } } and your XAML looks like XAML: <ListBox Name=”lstNames” ItemsSource=”{Binding Names}”/> Set … Read more