private void InternalValidateProperty(string propertyName, object value) { var results = new List <ValidationResult>(); bool isValid = Validator.TryValidateProperty(value, new ValidationContext(this, null, null) { MemberName = propertyName }, results); if (isValid) { RemoveErrors(propertyName); } else { AddErrors(propertyName, results); } NotifyErrorsChanged(propertyName); BindingHelper.InternalNotifyPropertyChanged("HasErrors", this, propertyChanged); }
/// <summary> /// Restores original /// </summary> public void CancelEdit() { // Return if BeginEdit not called first if (Copy == null) { return; } // Point entity to original Model = Original; // Clear copy Copy = null; // Notify IsEditing, IsDirty BindingHelper.InternalNotifyPropertyChanged("IsEditing", this, base.propertyChanged); BindingHelper.InternalNotifyPropertyChanged("IsDirty", this, base.propertyChanged); // Post-processing OnCancelEdit(); }
/// <summary> /// Allows you to specify a lambda for notify property changed /// </summary> /// <typeparam name="TResult">Property type</typeparam> /// <param name="property">Property for notification</param> protected virtual void NotifyPropertyChanged <TResult> (Expression <Func <TModel, TResult> > property) { // Fire PropertyChanged event BindingHelper.NotifyPropertyChanged(property, this, propertyChanged, dispatcher); }