CanResetValue() public abstract method

When overridden in a derived class, indicates whether resetting the component will change the value of the component.

public abstract CanResetValue ( object component ) : bool
component object
return bool
Beispiel #1
0
        /// <summary>
        /// Returns whether or not the property can be reset</summary>
        /// <param name="owners">Objects whose property is tested</param>
        /// <param name="descriptor">Property to reset</param>
        /// <returns>True iff the property can be reset on the object</returns>
        public static bool CanResetProperty(IEnumerable <object> owners, PropertyDescriptor descriptor)
        {
            foreach (object owner in owners)
            {
                if (!descriptor.CanResetValue(owner))
                {
                    return(false);
                }
            }

            return(true);
        }
 private void _ResetProperty(PropertyDescriptor pd)
 {
     if (pd.CanResetValue(this.objectContext)) {
         pd.ResetValue(this.objectContext);
         OnPropertyChanged(new PropertyChangedEventArgs(pd.Name));
     }
 }
Beispiel #3
0
 /// <summary>
 /// Sets the font for a property editing control</summary>
 /// <param name="control">Property editing control</param>
 /// <param name="descriptor">Property descriptor</param>
 protected void SetFont(Control control, PropertyDescriptor descriptor)
 {
     Sce.Atf.Dom.AttributePropertyDescriptor attr_descriptor = descriptor as Sce.Atf.Dom.AttributePropertyDescriptor;
     if ((attr_descriptor != null) && (attr_descriptor.AttributeInfo.Type.Type == Sce.Atf.Dom.AttributeTypes.String))
     {
         control.Font = null;
     }
     else
     {
         bool isOverride = descriptor.CanResetValue(LastSelectedObject);
         control.Font = isOverride ? BoldFont : null;
     }
 }
 private void _ResetProperty(PropertyDescriptor pd)
 {
     if (pd.CanResetValue(this.objectContext)) {
         pd.ResetValue(this.objectContext);
     }
 }
Beispiel #5
0
        /// <summary>
        /// Returns whether or not the property can be reset</summary>
        /// <param name="owners">Objects whose property is tested</param>
        /// <param name="descriptor">Property to reset</param>
        /// <returns>True iff the property can be reset on the object</returns>
        public static bool CanResetProperty(IEnumerable<object> owners, PropertyDescriptor descriptor)
        {
            foreach (object owner in owners)
                if (!descriptor.CanResetValue(owner))
                    return false;

            return true;
        }
        /// <summary>
        /// Tests if the property values for the current selection can be reset</summary>
        /// <param name="descriptor">Property descriptor representing property</param>
        /// <returns>True iff the property values for the current selection can be reset</returns>
        public bool CanResetValue(PropertyDescriptor descriptor)
        {
            foreach (object selected in m_selection)
                if (!descriptor.CanResetValue(selected))
                    return false;

            return true;
        }