Export (0) Print
Expand All

PropertyDescriptor.ResetValue Method

When overridden in a derived class, resets the value for this property of the component to the default value.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

public abstract void ResetValue(
	Object component
)

Parameters

component
Type: System.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:

  1. There is a shadowed property for this property.

  2. There is a DefaultValueAttribute for this property.

  3. 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:

  1. The method calls the IDesignerHost.CreateTransaction method to create a new DesignerTransaction to represent the changes.

  2. The method calls the IComponentChangeService.OnComponentChanging method to indicate that the transaction has begun and the changes are about to occur.

  3. The method resets the property to the value determined by this method's checking order.

  4. The method calls the IComponentChangeService.OnComponentChanged method to indicate that the changes have occurred.

  5. The method calls DesignerTransaction.Commit to indicate that the transaction is completed.

The purpose of the transaction is to support Undo and Redo functionality.

Notes to Inheritors

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 method invokes it. If ResetValue cannot find a DefaultValueAttribute or a "ResetMyProperty" method that you implemented, it does not perform an operation.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft