StaticExtension.ProvideValue Method

Returns an object value to set on the property where you apply this extension. For StaticExtension, this object value is the static value that is evaluated for the requested static member.

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

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



An object that can provide services for the markup extension. This service is expected to provide results for IXamlTypeResolver.

Return Value

The object value to set on the property where the extension is applied.

Exception typeCondition


The member value for the extension is a null reference (Nothing in Visual Basic). You must set this value before a call is made to ProvideValue.


Some part of the member string did not parse properly.

- or -

serviceProvider did not provide a service for IXamlTypeResolver.

- or -

member value did not resolve to a static member.

This method supports WPF XAML reader implementation and is not intended to be called directly. The XAML reader implementation uses this method to correctly handle the x:Static extension values during object creation.

This implementation relies on services that are based on the passed serviceProviderserviceProvider must not be a null reference (Nothing in Visual Basic). The serviceProvider object is expected to implement IXamlTypeResolver.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0