开发者

Can ASP.NET Page use WPF Controls?

开发者 https://www.devze.com 2023-03-15 22:34 出处:网络
I was wondering if ASPX page can use WPF Controls (from the toolbox in the designer)? Because I have a custom user control that I made for a application before but now i am creating a web app. In the

I was wondering if ASPX page can use WPF Controls (from the toolbox in the designer)?

Because I have a custom user control that I made for a application before but now i am creating a web app. In the web app the controls were grayed out.

I was wonderin开发者_如何学Pythong if there is a way to use the user control in the web app?


Unfortunately, you'll have to create a new ASP.Net control that mimics your WPF control. The two technologies have completely different approaches to rendering (DirectX primitives vs. HTML), events (Routed events vs. Postbacks), etc. and are simply not compatible.

That being said, converting a WPF control to a Silverlight control is doable, and would allow you to leverage your previous work. You would still need to run it through a Silverlight app, though, rather than directly through the ASPX page.


ASP.NET is primarily a server side framework and WPF applications run on the client, therefore they don't really work well together. You might find it easier to convert the WPF control into a Silverlight control instead and pass that through your ASP.NET page. Users will need a Silverlight plugin to run it.

These two posts might help in the conversion:

Porting from WPF to Silverlight: The Missing Pieces, Part 1

Porting from WPF to Silverlight: The Missing Pieces, Part 2

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号