PropertyDescriptor.ResetValue(Object) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
When overridden in a derived class, resets the value for this property of the component to the default value.
public:
abstract void ResetValue(System::Object ^ component);
public abstract void ResetValue (object component);
abstract member ResetValue : obj -> unit
Public MustOverride Sub ResetValue (component As Object)
- component
- Object
The component with the property value that is to be reset to the default value.
Typically, this method is implemented through reflection.
This method determines the value to reset the property to in the following order of precedence:
There is a shadowed property for this property.
There is a DefaultValueAttribute for this property.
There is a "ResetMyProperty" method that you have implemented, where "MyProperty" is the name of the property you pass to it.
This method creates a DesignerTransaction automatically in the following order:
The method calls the IDesignerHost.CreateTransaction method to create a new DesignerTransaction to represent the changes.
The method calls the IComponentChangeService.OnComponentChanging method to indicate that the transaction has begun and the changes are about to occur.
The method resets the property to the value determined by this method's checking order.
The method calls the IComponentChangeService.OnComponentChanged method to indicate that the changes have occurred.
The method calls DesignerTransaction.Commit to indicate that the transaction is completed.
The purpose of the transaction is to support Undo
and Redo
functionality.
When overridden in a derived class, this method looks for a DefaultValueAttribute. If it finds one, it sets the value of the property to the DefaultValueAttribute it found. If this method cannot find a DefaultValueAttribute, it looks for a "ResetMyProperty" method that you need to implement. If this is found, the ResetValue(Object) method invokes it. If ResetValue(Object) cannot find a DefaultValueAttribute or a "ResetMyProperty" method that you implemented, it does not perform an operation.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: