StaticExtension Class


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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

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


public class StaticExtension : MarkupExtension


Initializes a new instance of the StaticExtension class.


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


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


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


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)


Creates a shallow copy of the current Object.(Inherited from Object.)


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.(Overrides MarkupExtension.ProvideValue(IServiceProvider).)


Returns a string that represents the current object.(Inherited from Object.)

This class is a markup extension implementation for {x:Static} in the .NET XAML services support of XAML language features. For XAML usage information, see x:Static Markup Extension.

You typically use static references to obtain static values from types, including from types that cannot be instantiated in XAML because the type is static. Common examples of cases where {x:Static} is useful include values that can be thought of as constants, such as fixed math values or unique keys for states. The static members being referenced do not have to come from specific framework assemblies associated with XAML schema context. You can map other assemblies and CLR namespaces for XAML usage and then can refer to static members of types in XAML using the prefix you mapped.

.NET Framework
Available since 3.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top