Edit

Share via


StaticResourceExtension.ProvideValue(IServiceProvider) Method

Definition

Returns an object that should be set on the property where this extension is applied. For StaticResourceExtension, this is the object found in a resource dictionary, where the object to find is identified by the ResourceKey.

public:
 override System::Object ^ ProvideValue(IServiceProvider ^ serviceProvider);
public override object ProvideValue (IServiceProvider serviceProvider);
override this.ProvideValue : IServiceProvider -> obj
Public Overrides Function ProvideValue (serviceProvider As IServiceProvider) As Object

Parameters

serviceProvider
IServiceProvider

Object that can provide services for the markup extension.

Returns

The object value to set on the property where the markup extension provided value is evaluated.

Exceptions

serviceProvider was null, or failed to implement a required service.

Remarks

This method supports WPF XAML processor implementation, and is not intended to be called directly. The XAML processor implementation uses this method for proper handling of StaticResource extension values during object creation.

The property to be set can be identified by a PropertyInfo (standard property) or DependencyProperty (dependency property).

This implementation relies on XAML-related services based on the passed serviceProvider. It must not be null. In the .NET Framework 4 implementation, the following are required services from service context:

If any of these services are missing, usage of the markup extension throws an exception.

Applies to