我可以在ASP.NET页中发布WPF控件吗? [英] Can I post WPF controls in ASP.NET page?

查看:70
本文介绍了我可以在ASP.NET页中发布WPF控件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用WPF开发的用户控件,必须在ASP.NET页面中使用它.有可能吗?

*提示:使程序集COM可见还是什么?

要求是在iPad上运行该应用程序,并且我们知道iPad将不支持任何安装且不支持Silverlight.有什么想法吗?

*解决方法可能是在iPad [parallels.com]上安装虚拟窗口,但我不满意.

I have a user control developed in WPF and I have to use it in ASP.NET page. Is it possible?

*Hint: Make assembly COM visible or something?

the requirement is to run the app on iPad, and as we know iPad will not support any installations and not supporting silverlight. any thoughts?

*Workaround may be installing virtual windows on iPad [parallels.com], but I am not happy.

推荐答案

您可以将其放在ActiveX控件中,是的(这是您使用COM将某些内容放入网页中的方式.当然,如果您还没有,则您的用户需要安装.NET.您是否考虑过将其移植到Silverlight?我认为这种机制
You MIGHT be able to put it in an ActiveX control, yes ( which is how you use COM to put something in a web page. Of course, your users then need to install .NET if htey don''t have it. Have yo considered porting it to Silverlight instead ? I think the mechanism for downloading the plugin is probably more well defined.


基本上,不是.ASP.net只是提供了HTML(但它试图向您隐藏的内容),而该HTML是由浏览器呈现的,和WPF控件是丰富的桌面事件驱动框架的一部分,两者不兼容,您不能只是将桌面控件嵌入到网页中,无论它们是WPF还是WinForms.
(这是我在使用ASP.net时遇到的主要问题之一,它很难像桌面应用程序那样容易使用,因此容易引起混淆,并且由于它很好地隐藏了差异,因此还引起了像您一样的问题.)

正如克里斯蒂安所说,WPF与Silverlight非常相似,只需最少的移植,您就可以使WPF控件与浏览器插件Silverlight一起使用.但是,如果苹果公司说他们的浏览器不支持Silverlight,那将无济于事.

您有两个选择:
-不要为iPad开发,请等待一些具有更好浏览器的平板电脑上市;我确定基于Chrome操作系统的操作系统将支持Chrome Silverlight插件,例如
-将用户控件重新开发为Web控件,以便可以通过ASP.net在网页中内联运行.根据控件的不同,这可能很容易,也可能不容易.通过回发和客户端Javascript/AJAX来使丰富的用户控件正常工作可能很棘手.
Essentially, no. ASP.net is simply serving up HTML (however much it tries to hide that from you) which gets rendered by the browser, and WPF controls are part of a rich desktop event-driven framework. The two are not compatible and you can''t just embed desktop controls in a web page, whether they be WPF or WinForms.

(This is one of my main problems with ASP.net, it pretends so hard to be like a desktop app that it is confusing to use, and it also results in questions like yours because it has hidden the difference too well.)

As Christian says, WPF is very similar to Silverlight and with minimal porting you can get a WPF control to work with Silverlight, which is a browser plugin. But if Apple have said that their browser won''t support Silverlight then that doesn''t help.

The two options you have are:
- don''t develop for iPad, wait for some tablets to hit the market which have a better browser; I''m sure a Chrome OS based one will support the Chrome Silverlight plugin, for example
- redevelop your user control as a web control so it can be run inline in a web page through ASP.net. Depending on what the control is, this may or may not be easy; making rich user controls work well through postback and client side Javascript/AJAX can be tricky.


不幸的是,您无法在iPad上运行WPF应用程序(或其部分).您也不能运行Silverlight.恐怕您唯一的选择是在iPad上运行的某些代码(例如HTML或Objective C)中重新实现代码.
Unfortunately, you can''t run WPF applications (or parts thereof) on an iPad. Nor can you run Silverlight. I''m afraid your only option is to reimplement the code in something that will run on the iPad (such as HTML or Objective C).


这篇关于我可以在ASP.NET页中发布WPF控件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆