示例#1
0
 /// <summary>
 /// Fires the property changed event for the <paramref name="property"/>.
 /// </summary>
 /// <param name="property">The name of the property being changed.</param>
 /// <returns>Returns <c>true</c> if the event is fired successfully. Otherwise returns <c>false</c>.</returns>
 protected bool FirePropertyChanged([CallerMemberName] string property = null)
 {
     // ReSharper disable once ExplicitCallerInfoArgument
     return(NotifyPropertyChanged.FireNotifyPropertyChanged(this, this.PropertyChanged, property));
 }
示例#2
0
 /// <summary>
 /// Sets a property to a new value and fires the PropertyChanged event.
 /// </summary>
 /// <typeparam name="T">Type of the property</typeparam>
 /// <param name="original">The original property value.</param>
 /// <param name="value">The new value.</param>
 /// <param name="property">The name of the property being changed.</param>
 /// <returns>Returns <c>true</c> if the property is set and the property changed event fires. Returns <c>false</c> if <paramref name="original"/> equals <paramref name="value"/>.</returns>
 protected bool SetProperty <T>(ref T original, T value, [CallerMemberName] string property = null)
 {
     // ReSharper disable ExplicitCallerInfoArgument
     return(NotifyPropertyChanged.SetProperty(this, this.PropertyChanged, ref original, value, property));
     // ReSharper restore ExplicitCallerInfoArgument
 }