ToolboxItem.ValidatePropertyValue(String, Object) Method

Definition

Validates a property before it is assigned to the property dictionary.

C#
protected virtual object ValidatePropertyValue(string propertyName, object value);
C#
protected virtual object? ValidatePropertyValue(string propertyName, object? value);

Parameters

propertyName
String

The name of the property to validate.

value
Object

The value against which to validate.

Returns

The value used to perform validation.

Exceptions

value is null, and propertyName is "IsTransient".

Remarks

The ValidatePropertyValue method is called whenever a value is set in the property dictionary. With this method, you can change the value of an object before committing it, or reject it by throwing an exception.

Applies to

Product Versions
.NET Framework 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, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10