MarkupExtension Class
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Provides a base class for XAML markup extension implementations that can be supported by .NET Framework XAML Services and other XAML readers and XAML writers.
Namespace: System.Windows.Markup
Assembly: System.Xaml (in System.Xaml.dll)
The MarkupExtension type exposes the following members.
| Name | Description | |
|---|---|---|
|
MarkupExtension | Initializes a new instance of a class derived from MarkupExtension. |
| Name | Description | |
|---|---|---|
|
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
|
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
|
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
|
GetType | Gets the Type of the current instance. (Inherited from Object.) |
|
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
|
ProvideValue | When implemented in a derived class, returns an object that is provided as the value of the target property for this markup extension. |
|
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Markup extensions return objects to callers, based on the input of string attribute values or markup elements in XAML. Markup extensions return objects in a more sophisticated way than type converters alone can accomplish. A XAML object writer invokes a type converter because a type or member has a type converter implementation associated with it. From the CLR frame of reference, this means that a type or member is TypeConverterAttribute attributed. From the XAML type system perspective, this means that a XAML type or a XAML member has a value for its TypeConverter property. The invocation of a type converter is tied to the type or property definition, and is always invoked by XAML processing for these cases. In contrast, a markup extension is more under the control of user code and user-produced markup, and can be applied whenever an application scenario demands it. A markup extension can be invoked and can be used for setting different type-member values, so long as the markup extension's return type is assignable to that value.
For information on creating a custom markup extension, see ProvideValue. For more information on markup extensions in general, see Markup Extensions for XAML Overview. If you are building on WPF and using or creating markup extensions for XAML, other relevant information can be found in the topic Markup Extensions and WPF XAML.
The ProvideValue method of each markup extension implementation can use an IServiceProvider at run time that can provide context. This IServiceProvider is then queried for specific services that pass information, such as IProvideValueTarget or IXamlTypeResolver. For more information on service contexts for a markup extension, see Service Contexts Available to Type Converters and Markup Extensions.
Derived classes should be attributed with MarkupExtensionReturnTypeAttribute to inform consumers of the most specific return type available from the markup extension's ProvideValue implementation.
Windows 8 Release Preview, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 SP2, 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.
System.Windows.Markup.MarkupExtension
System.Activities.Presentation.CachedResourceDictionaryExtension
System.Activities.XamlIntegration.DynamicUpdateMapExtension
System.Activities.XamlIntegration.PropertyReferenceExtension<T>
System.ServiceModel.EndpointIdentityExtension
System.ServiceModel.XamlIntegration.SpnEndpointIdentityExtension
System.ServiceModel.XamlIntegration.UpnEndpointIdentityExtension
System.ServiceModel.XamlIntegration.XPathMessageContextMarkupExtension
System.Windows.ColorConvertedBitmapExtension
System.Windows.Data.BindingBase
System.Windows.Data.RelativeSource
System.Windows.DynamicResourceExtension
System.Windows.Markup.ArrayExtension
System.Windows.Markup.NullExtension
System.Windows.Markup.Reference
System.Windows.Markup.StaticExtension
System.Windows.Markup.TypeExtension
System.Windows.ResourceKey
System.Windows.StaticResourceExtension
System.Windows.TemplateBindingExtension
System.Windows.ThemeDictionaryExtension