Hi, use TrulyObservableCollection to detect changes in data objects. ViewModel consuming PropertyChanged event can check data objects and enable/disable button:
/// <summary>
/// Implements the "ItemPropertyChanged" Event for a ObservableCollection
/// </summary>
/// <typeparam name="T"></typeparam>
/// <seealso cref="System.Collections.ObjectModel.ObservableCollection{T}" />
public sealed class TrulyObservableCollection<T> : ObservableCollection<T>
where T : INotifyPropertyChanged
{
/// <summary>
/// Initializes a new instance of the <see cref="TrulyObservableCollection{T}"/> class.
/// </summary>
public TrulyObservableCollection() => CollectionChanged += FullObservableCollectionCollectionChanged;
/// <summary>
/// Initializes a new instance of the <see cref="TrulyObservableCollection{T}"/> class.
/// </summary>
/// <param name="pItems">The p items.</param>
public TrulyObservableCollection(IEnumerable<T> pItems) : this()
{
foreach (var item in pItems) this.Add(item);
}
/// <summary>
/// Fulls the observable collection collection changed.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="NotifyCollectionChangedEventArgs"/> instance containing the event data.</param>
private void FullObservableCollectionCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.NewItems != null) foreach (Object item in e.NewItems) ((INotifyPropertyChanged)item).PropertyChanged += ItemPropertyChanged;
if (e.OldItems != null) foreach (Object item in e.OldItems) ((INotifyPropertyChanged)item).PropertyChanged -= ItemPropertyChanged;
}
/// <summary>
/// Items the property changed.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
private void ItemPropertyChanged(object sender, PropertyChangedEventArgs e) => OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, sender, sender, IndexOf((T)sender)));
}