Class
StaticExtension

Implements a markup extension that returns static field and property references.

Definition

Namespace:Telerik.Core

Assembly:Telerik.WinUI.Controls.dll

Syntax:

cs-api-definition
public class StaticExtension : MarkupExtension

Inheritance: objectStaticExtension

Constructors

StaticExtension()

Initializes a new instance of the StaticExtension class.

Declaration

cs-api-definition
public StaticExtension()

StaticExtension(string)

Initializes a new instance of the StaticExtension class using the provided member string.

Declaration

cs-api-definition
public StaticExtension(string member)

Parameters

member

string

A string that identifies the member to make a reference to. This string uses the format prefix:typeName.fieldOrPropertyName.

Remarks

The member value is not evaluated when you set it. If the initial value is not null, then the value is accepted. The actual parsing and evaluation of the member value is deferred until is called when a XAML reader processes an extension usage. At that time, XAML schema context informs the type mapping and the value can be obtained.

Properties

Member

Gets or sets a member name string that is used to resolve a static field or property based on the service-provided type resolver.

Declaration

cs-api-definition
public string Member { get; set; }

Property Value

string

Remarks

The string for Member typically uses the format prefix:typeName.fieldOrPropertyName. The string can also specify only the member name, so long as MemberType is also supplied, but note that this technique will not support XML namespaces and prefixes; it is working at the type system level. This value is not evaluated when you set it; so long as the value is not null it will be accepted. The actual parsing and evaluation of the value is deferred until is called during parsing. Under the normal scenario of use by the Silverlight XAML processor, the XAML processor passes a type resolver for CLR types as part of its service contract, and this resolver is used on the ProvideValue call.

MemberType

Gets or sets the Type that defines the static member to return.

Declaration

cs-api-definition
public Type MemberType { get; set; }

Property Value

Type

Remarks

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. Note that this technique will not support XAML namespaces and prefixes; it is working against the backing type system, not the XAML type system.

Methods

ProvideValue(IXamlServiceProvider)

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.

Declaration

cs-api-definition
protected override object ProvideValue(IXamlServiceProvider serviceProvider)

Parameters

serviceProvider

IXamlServiceProvider

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

Returns

object

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

Remarks

This method supports XAML language features and is generally not intended to be called directly. This implementation relies on services that are based on the passed serviceProvider. serviceProvider must not be null. The serviceProvider object is expected to return a service for . Under the normal scenario of use by the default XAML readers, a suitable service provider is available. 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.