コード例 #1
0
        /// <summary>
        /// Sets the value of the notifying property.
        /// </summary>
        /// <param name="notifyingProperty">The notifying property.</param>
        /// <param name="value">The value to set.</param>
        /// <param name="forceUpdate">If set to <c>true</c> we'll force an update
        /// of the binding by calling NotifyPropertyChanged.</param>
        protected void SetValue(NotifyingProperty notifyingProperty, object value, bool forceUpdate = false)
        {
            //  We'll only set the value and notify that it has changed if the
            //  value is different - or if we are forcing an update.
            if (notifyingProperty.Value != value || forceUpdate)
            {
                //  Set the value.
                notifyingProperty.Value = value;

                //  Notify that the property has changed.
                NotifyPropertyChanged(notifyingProperty.Name);
            }
        }
コード例 #2
0
 /// <summary>
 /// Gets the value of a notifying property.
 /// </summary>
 /// <param name="notifyingProperty">The notifying property.</param>
 /// <returns>The value of the notifying property.</returns>
 protected object GetValue(NotifyingProperty notifyingProperty)
 {
     return(notifyingProperty.Value);
 }