Class DynamicResourceExtension
Implements a markup extension that supports dynamic resource references made from XAML.
Implements
Inherited Members
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public class DynamicResourceExtension : MarkupExtension, IMarkupExtension<object>
Constructors
| Improve this Doc View SourceDynamicResourceExtension()
Initializes a new instance of the DynamicResourceExtension class.
Declaration
public DynamicResourceExtension()
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 SourceResourceKey
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 SourceProvideValue(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
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Attempted to provide a value for an extension that did not provide a resourceKey. |