StaticExtension.ProvideValue Method

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

Namespace:  System.Windows.Markup
Assembly:  System.Xaml (in System.Xaml.dll)

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

Parameters

serviceProvider
Type: System.IServiceProvider

An object that can provide services for the markup extension. The service provider is expected to provide a service that implements a type resolver (IXamlTypeResolver).

Return Value

Type: System.Object
The static value to set on the property where the extension is applied.

ExceptionCondition
InvalidOperationException

The member value for the extension is Nothing at the time of evaluation.

ArgumentException

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.

ArgumentNullException

serviceProvider is Nothing.

This method supports XAML language features and is generally not intended to be called directly. The XAML processor 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 Nothing. The serviceProvider object is expected to return a service for IXamlTypeResolver. Under the normal scenario of use by the default XAML readers and XAML writers, a suitable service provider is available. An invalid XAML schema context might have the side effect of breaking type mapping and thus the IXamlTypeResolver service.

In .NET Framework 4, StaticExtension supports an alternate mode whereby it can return a static member based on Member being the simple member name and its owning type supplied as MemberType, rather than Member providing a full name in the form type.member. The type resolver still acts, but in this case the Member and MemberType are basically combined: memberFullName = MemberType.FullName + "." + Member.

.NET Framework

Supported in: 4.6, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft