ValueSerializer::GetSerializerFor Method (PropertyDescriptor^, IValueSerializerContext^)
Gets the ValueSerializer declared for the specified property, using the specified context.
Assembly: System.Xaml (in System.Xaml.dll)
public: static ValueSerializer^ GetSerializerFor( PropertyDescriptor^ descriptor, IValueSerializerContext^ context )
Parameters
- descriptor
-
Type:
System.ComponentModel::PropertyDescriptor^
Descriptor for the property to be serialized.
- context
-
Type:
System.Windows.Markup::IValueSerializerContext^
Context information that is used for conversion.
Return Value
Type: System.Windows.Markup::ValueSerializer^The serializer associated with the specified property.
| Exception | Condition |
|---|---|
| ArgumentNullException | descriptor is null. |
Rather than relying purely on attributes reported in the CLR type system, this overload uses the context as a service, and calls the service's implementation of IValueSerializerContext::GetValueSerializerFor. The IValueSerializerContext::GetValueSerializerFor implementation would typically also rely on the descriptor, but might implement special behavior for certain contexts.
This method should be called when the caller has an available IValueSerializerContext from a service. This will ensure that the correct ValueSerializer is returned for the specific context.
If the context returns null from its IValueSerializerContext::GetValueSerializerFor for your specified descriptor, or if the context you specify is null, then behavior is identical to calling the GetSerializerFor(PropertyDescriptor^) overload.
Available since 3.0