ProvideValue Method
Collapse the table of content
Expand the table of content

StaticResourceExtension.ProvideValue Method

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.

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

'Declaration
Public Overrides Function ProvideValue ( _
	serviceProvider As IServiceProvider _
) As Object

Parameters

serviceProvider
Type: System.IServiceProvider
Object that can provide services for the markup extension.

Return Value

Type: System.Object
The object value to set on the property where the markup extension provided value is evaluated.

ExceptionCondition
InvalidOperationException

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

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 Nothing. 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.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2016 Microsoft