Hi.
You need to implement INotifyPropertyChanged on you viewmodel (class with your observable collection).
Once that is done you'll use the eventhandler provided by the interface to let your GUI know that whenever your collection is updated.
Typcally it looks like this.
public class YourClass : INotifyPropertyChagned
{
private ObservableCollection<string> _collectionOfStrings;
public ObservableCollection<string> CollectionOfStrings
{
get => _collectionOfStrings
set
{
if (value != _collectionOfStrings)
{
_listOfStrings = value;
OnPropertyChagned("CollectionOfStrings");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName =
null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}