PropertyDescriptor.SetValue(Object, Object) Method
Definition
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, sets the value of the component to a different value.
public:
abstract void SetValue(System::Object ^ component, System::Object ^ value);
public abstract void SetValue (object component, object value);
public abstract void SetValue (object? component, object? value);
abstract member SetValue : obj * obj -> unit
Public MustOverride Sub SetValue (component As Object, value As Object)
Parameters
- component
- Object
The component with the property value that is to be set.
- value
- Object
The new value.
Remarks
Typically, this method is implemented through reflection.
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 complete.
The purpose of the transaction is to support Undo
and Redo
functionality.
Notes to Implementers
When you override this method, it should set the value of the property by invoking the appropriate "SetMyProperty" method that you need to implement. If the value specified is not valid, the component should throw an exception, which is passed up. You should design the property so that a "GetMyProperty" method (that you have implemented) following a "SetMyProperty" method returns the value passed in when the "SetMyProperty" method does not throw an exception.
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om