Redigera

Dela via


XamlMemberInvoker.SetValue(Object, Object) Method

Definition

Sets a value of the relevant property on an instance.

public:
 virtual void SetValue(System::Object ^ instance, System::Object ^ value);
public virtual void SetValue (object instance, object value);
abstract member SetValue : obj * obj -> unit
override this.SetValue : obj * obj -> unit
Public Overridable Sub SetValue (instance As Object, value As Object)

Parameters

instance
Object

An instance of the owner type for the member.

value
Object

The property value to set.

Exceptions

instance is null.

Invoked this method on a XamlMemberInvoker that is based on an unknown XamlMember.

-or-

Invoked this method on a read-only member.

-or-

UnderlyingSetter is null.

Notes to Inheritors

The base implementation includes a call to the internal helper ThrowIfUnknown. This helper always throws for cases where a XamlMemberInvoker is based on an unknown XamlMember, which includes cases where the UnderlyingMember of the XamlMember is null.

The base implementation throws if UnderlyingSetter is null.

For static properties (IsStatic is true per UnderlyingSetter) the default implementation calls Invoke(Object, Object[]) on UnderlyingSetter passing null as the first parameter and packaging instance and value as the second parameter. For non-static properties, it calls Invoke(Object, Object[]) and forwards instance as first parameter and value as second parameter.

Applies to