How do I update an IValueConverter on CollectionChanged?

后端 未结 4 1753
天涯浪人
天涯浪人 2020-12-20 22:13

Here\'s a basic example to explain my problem. Let\'s say I have

ObservableCollection Numbers {get; set;}

and an IValueConverte

4条回答
  •  半阙折子戏
    2020-12-20 23:01

    In your model, subscribe to CollectionChanged and raise PropertyChanged:

    Numbers.CollectionChanged += (o,e) => 
      OnPropertyChanged(new PropertyChangedEventArgs(nameof(Numbers)));
    

    And, as thomasgalliker mentioned, you should unsubscribe from the event when the model containing the connection is no longer used.

提交回复
热议问题