DynamicResourceExtension DynamicResourceExtension DynamicResourceExtension DynamicResourceExtension Class


实现一个标记扩展,该标记扩展支持从 XAML 中进行的动态资源引用。Implements a markup extension that supports dynamic resource references made from XAML.

public ref class DynamicResourceExtension : System::Windows::Markup::MarkupExtension
public class DynamicResourceExtension : System.Windows.Markup.MarkupExtension
type DynamicResourceExtension = class
    inherit MarkupExtension
Public Class DynamicResourceExtension
Inherits MarkupExtension


引用可能会在运行时更改的内容时,动态资源引用是必需的。Dynamic resource references are necessary when referencing content that might change at run-time. 内容更改的原因可能是应用程序启动,也可能是外部。The reasons for the content change might be application-initiated or might be external. 一个示例是指要包括依赖于报告用户配置首选项,如主题、 字体设置等的系统资源的样式。One example is if you are including styles that rely on system resources that report user-configured preferences, such as themes, font settings and so on.

此类是标记扩展实现。This class is a markup extension implementation. 中的标记扩展类WPFWPF存在主要是为了提供基础结构支持的某些方面WPFWPFXAMLXAML处理器实现中,并由标记扩展类不会从通常调用公开的成员直接用户代码。Markup extension classes in WPFWPF exist mainly to provide infrastructure support for some aspect of the WPFWPF XAMLXAML processor implementation, and the members exposed by the markup extension classes are not typically called from directly user code. 特别是,此类支持DynamicResource 标记扩展从使用情况XAMLXAMLThis class particularly supports the DynamicResource Markup Extension usage from XAMLXAML. 有关动态资源引用的详细信息,请参阅DynamicResource 标记扩展For more information about dynamic resource references, see DynamicResource Markup Extension.

XAML 文本使用情况XAML Text Usage

有关XAMLXAML信息,请参阅DynamicResource 标记扩展For XAMLXAML information, see DynamicResource Markup Extension.


DynamicResourceExtension() DynamicResourceExtension() DynamicResourceExtension() DynamicResourceExtension()

初始化 DynamicResourceExtension 类的新实例。Initializes a new instance of the DynamicResourceExtension class.

DynamicResourceExtension(Object) DynamicResourceExtension(Object) DynamicResourceExtension(Object) DynamicResourceExtension(Object)

用提供的初始键初始化 DynamicResourceExtension 类的新实例。Initializes a new instance of the DynamicResourceExtension class, with the provided initial key.


ResourceKey ResourceKey ResourceKey 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.


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ProvideValue(IServiceProvider) ProvideValue(IServiceProvider) ProvideValue(IServiceProvider) ProvideValue(IServiceProvider)

返回一个应在应用了此扩展的属性上设置的对象。Returns an object that should be set on the property where this extension is applied. 对于 DynamicResourceExtension,这是当前父级链的资源字典中的对象,该对象的键由 ResourceKey 指定。For DynamicResourceExtension, this is the object found in a resource dictionary in the current parent chain that is keyed by the ResourceKey.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)