Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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 in the current parent chain that is keyed by the ResourceKey.

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

public override Object ProvideValue(
	IServiceProvider serviceProvider
)
You cannot use methods in XAML.

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 extension is applied.

ExceptionCondition
InvalidOperationException

serviceProvider was null, or failed to implement IProvideValueTarget.

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 a PropertyInfo (standard property) or DependencyProperty.

This implementation relies on services based on the passed serviceProvider. It must not be null. The actual property is set by having the serviceProvider object also implement IProvideValueTarget.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0

Community Additions

ADD
Show:
© 2015 Microsoft