Can I replace WPF by Silverlight
Could Silverlight and 开发者_JS百科WPF be interchangeable?
I mean, using Silverlight
for Windows applications and WPF
for web applications.
Silverlight and WPF are similar, but not interchangeable.
Silverlight and WPF are two different technologies intended to solve different problems. Silverlight has out-of-browser functionality, but must be delivered over the web in a browser first. WPF has XBAP, but it's still a WPF application. They are both XAML-based, so there is some limited ability to share resources.
If you are designing an application, select the technology that is most appropriate to the problem and the target audience. Keep in mind that while Silverlight runtime installs are growing fast, they still lag far behind others. Some people flatly refuse to install it. WPF apps can be distributed like desktop applications with an executable.
Update: In my experience, WPF XBAP applications don't behave well in browsers that aren't IE.
SL 4 can work in an out of browser mode. WPF has the XBAP (XAML browser application). So in a way they are but consider the limitations you may encounter in your projects.
Regards...
Some user controls can be reused between the two platforms. But because of the very different ways Silverlight and WPF interact with their environments (WPF on local system, Silverlight in browser plug-in sandbox) not all of the code is fully interchangable.
It's theoretically possible, but would require extra effort to port. And each is best suited to its environment. Here's an interesting discussion from an MS forum:
http://forums.silverlight.net/forums/p/1178/4244.aspx
For the most part, WPF is designed to run on the desktop and Silverlight and designed to run as part of a web page.
You can deploy a silverlight application to a desktop and run it from there, but there is no way to run a WPF UI "on the web".
With Silverlight 4 you can create a full trust application that is installed in the same was as a WPF application.
This article has a walkthrough.
So in this sense you can replace WPF with Silverlight.
You can link to WPF XAML pages on the web. This page has such a link, but you need a plugin to view it. I wouldn't want to deploy a full application this way though & I think it's only individual pages.
精彩评论