IComponentConnector 接口

定义

为命名的 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 根元素的生成类, 都可以在输出InitializeComponent中看到。For 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 4IComponentConnector , 为 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.

InitializeComponent()

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

适用于