On custom property setter I try to call my custom event and pass NotifyCollectionChangedAction.Replace
as parameter for the NotifyCollectionChangedEventArgs
but I get an System.ArgumentException
.
What i'm doing wrong?
my custom event :
public event EventHandler<NotifyCollectionChangedEventArgs> MyEntryChanged;
protected virtual void OnMyEntryChanged(NotifyCollectionChangedEventArgs e)
{
var handler = MyEntryChanged;
handler?.Invoke(this, e);
}
and my call :
private TValue _value;
public TValue Value
{
get { return _value; }
set
{
if (Equals(_value, value)) return;
_value = value;
OnMyEntryChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace));
OnPropertyChanged();
}
}