Show / Hide Table of Contents

Class DynamicResourceExtension

Implements a markup extension that supports dynamic resource references made from XAML.

Inheritance
System.Object
MarkupExtension
DynamicResourceExtension
Implements
IMarkupExtension<System.Object>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public class DynamicResourceExtension : MarkupExtension, IMarkupExtension<object>

Constructors

| Improve this Doc View Source

DynamicResourceExtension()

Initializes a new instance of the DynamicResourceExtension class.

Declaration
public DynamicResourceExtension()
| Improve this Doc View Source

DynamicResourceExtension(Object)

Initializes a new instance of the DynamicResourceExtension class, with the provided initial key.

Declaration
public DynamicResourceExtension(object resourceKey)
Parameters
Type Name Description
System.Object resourceKey

The key of the resource that this markup extension references.

Properties

| Improve this Doc View Source

ResourceKey

Gets or sets the key specified by this dynamic resource reference. The key is used to lookup a resource in resource dictionaries, by means of an intermediate expression.

Declaration
public object ResourceKey { get; set; }
Property Value
Type Description
System.Object

The resource key that this dynamic resource reference specifies.

Methods

| Improve this Doc View Source

ProvideValue(IServiceProvider)

Returns an object that should be set on the property where this extension is applied. For DynamicResourceExtension, this is the object found in a resource dictionary in the current parent chain that is keyed by the ResourceKey.

Declaration
public override object ProvideValue(IServiceProvider serviceProvider)
Parameters
Type Name Description
System.IServiceProvider serviceProvider

Object that can provide services for the markup extension.

Returns
Type Description
System.Object

The object to set on the property where the extension is applied. Rather than the actual value, this will be an expression that will be evaluated at a later time.

Overrides
MarkupExtension.ProvideValue(IServiceProvider)
Exceptions
Type Condition
System.InvalidOperationException

Attempted to provide a value for an extension that did not provide a resourceKey.

Implements

IMarkupExtension<T>
  • Improve this Doc
  • View Source