IComponentConnector Interface


为命名 XAML 元素提供标记编译和工具支持,以及将事件处理程序附加到这些元素。Provides markup compile and tools support for named XAML elements and for attaching event handlers to them.

public interface class IComponentConnector
public interface IComponentConnector
type IComponentConnector = interface
Public Interface IComponentConnector


此接口由 Baml2006Reader在内部使用。This interface is used internally by Baml2006Reader.

InitializeComponent 的实现被广泛视为框架或技术所提供的基础结构的一部分,这些框架或技术将 XAML 与应用程序和编程模型结合使用。Implementations of InitializeComponent are widely observable as part of the infrastructure provided by frameworks or technologies that use XAML combined with application and programming models. 例如,无论何时查看 WPF 页和应用程序中的 XAML 根元素的生成类,都将看到输出中定义 InitializeComponentFor example, whenever you look at the generated classes for XAML root elements in WPF pages and applications, you will see InitializeComponent defined in the output. 此方法也存在于已编译的程序集中,并在 WPF 应用程序模型中扮演 XAML 分析时加载 XAML UI 内容的角色。That method also exists in the compiled assembly and plays a role in the WPF application model of loading the XAML UI content at XAML parse time. 有关 InitializeComponent 概念的 WPF 集成的详细信息,请参阅应用程序管理概述Wpf 中的代码隐藏和 XAMLFor more information on the WPF integration of the InitializeComponent concept, see Application Management Overview or Code-Behind and XAML in WPF.

在 .NET Framework 的以前版本中,此接口存在于 WPF 特定的程序集 WindowsBase 中。In previous versions of the .NET Framework, this interface existed in the WPF-specific assembly WindowsBase. .NET Framework 4.NET Framework 4中,IComponentConnector 在 system.exception 程序集中。In .NET Framework 4.NET Framework 4, IComponentConnector is in the System.Xaml assembly. .. 有关详细信息,请参阅 Types Migrated from WPF to System.XamlFor more information, see Types Migrated from WPF to System.Xaml.


在尝试生成期间未能解析 IComponentConnector 通常表明你尚未正确更新 WPF 项目。A failure to resolve IComponentConnector during an attempted build is often an indicator that you have not updated your WPF project correctly. 具体而言,项目不会引用面向 .NET Framework 4.NET Framework 4的项目的 system.exception 程序集。In particular, the project is not referencing the System.Xaml assembly for a project that targets .NET Framework 4.NET Framework 4. 尝试为项目运行 devenv /upgrade 选项,或调整项目程序集引用,使 system.exception 位于引用列表中。Try running the devenv /upgrade option for the project, or otherwise adjust the project assembly references so that System.Xaml is in the reference list.


Connect(Int32, Object)

将事件和名称附加到已编译的内容。Attaches events and names to compiled content.


加载组件的已编译页面。Loads the compiled page of a component.

Applies to