需要帮助 - WPF 中的 IWindowsFormsEditorService?或者可能是我的问题的另一种替代解决方案

发布于 2024-10-07 06:55:21 字数 1198 浏览 4 评论 0原文

我已采用以下代码并将其扩展为我的代码:

http://www.codeproject .com/KB/vb/PropertyGridEx.aspx

我的代码是用 WPF 编写的程序,而示例位于 Windows 窗体应用程序中

我的代码-

http://pastebin.com/phshqYwY

我的问题-

“IWindowsFormsEditorService”仅适用于由 Windows 窗体应用程序创建的 UserControl 窗口,因此以下行:

wfes.DropDownControl(ucUseValue);

显示以下错误:

错误 1 ​​与“System.Windows.Forms.Design.IWindowsFormsEditorService.DropDownControl(System.Windows.Forms.Control)”匹配的最佳重载方法具有一些无效参数

错误 2 参数 1:无法从“Visual_Command_Line.UserControls.ArgumentEditor.UseValueArg”转换为“System.Windows.Forms.Control”

所以,我想到了两种解决方案 - 告诉我其中之一是否可行:

  1. WPF 中是否有“IWindowsFormsEditorService”的替代方案?

  2. 有没有可能的方法将我的 UserControl(“UseValueArg”)转换为 System.Windows.Forms.UserControl 类型的 UserControl?

  3. 一个 System.Windows.Forms.Control 类型而不是 WPF 类型的 UserControl(我已经尝试过并且它有效,尽管在 WPF 中使用 Windows 窗体应用程序似乎很愚蠢)

提前感谢, 喧闹声

I've taken the following code and extended it to my code:

http://www.codeproject.com/KB/vb/PropertyGridEx.aspx

My code is a program written in WPF while the example is in Windows Forms Application

My code-

http://pastebin.com/phshqYwY

My problem-

the "IWindowsFormsEditorService" is only for UserControl windows that made by Windows Forms Application so the following row:

wfes.DropDownControl(ucUseValue);

Shows the following errors:

Error 1 The best overloaded method match for 'System.Windows.Forms.Design.IWindowsFormsEditorService.DropDownControl(System.Windows.Forms.Control)' has some invalid arguments

Error 2 Argument 1: cannot convert from 'Visual_Command_Line.UserControls.ArgumentEditor.UseValueArg' to 'System.Windows.Forms.Control'

So, i thought of two Solutions - tell me if one of them is possible:

  1. Is there any alternative to "IWindowsFormsEditorService" in WPF?

  2. Is there any possible way to convert my UserControl which is "UseValueArg" to a System.Windows.Forms.UserControl type of UserControl?

  3. Creating a UserControl that is of type System.Windows.Forms.Control and not of WPF (something which I already tried and it works, though it's seems stupid to have Windows Forms Application in a WPF)

Thanks in advanced,
Din

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

婴鹅 2024-10-14 06:55:21

虽然我的回答在主题中有点“偏离”,但您可能想尝试: http://wpg.codeplex.com /

Though my answer is a little 'off' in the topic, you might want to try: http://wpg.codeplex.com/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文