protected virtual void OnPropertyChanging(PropChangingEventArgs e) { if (PropertyChanging != null) { PropertyChanging(this, e); } }
protected override void SetPropertyField <T>(string propertyName, ref T field, T newValue) { if (!EqualityComparer <T> .Default.Equals(field, newValue)) { var ff = new PropChangingEventArgs(propertyName, field, newValue); OnPropertyChanging(ff); if (!ff.cancel) { newValue = (T)ff.NewValue; if (!EqualityComparer <T> .Default.Equals(field, newValue)) { field = newValue; DoPropChange(propertyName); } } } }