Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个想要添加到 Windows 窗体应用程序的 WPF 自定义控件。所以我添加了对 WPF 程序集的引用,创建了一个 ElementHost 并在代码中设置了 Child 属性。
有没有办法通过拖放来做到这一点,即无需编写代码?我尝试了 ElementHost 弹出窗口,但它没有列出我的组件。据我所见,它仅列出了项目中的 WPF 组件(而不是外部程序集)。
当您将元素主机拖放到窗口窗体时,它将显示下拉以选择子项,然后您可以添加 WPF 自定义控件而无需代码。