简体   繁体   中英

Deploy a WPF user control in a Silverlight application

I have developed a user control in WPF which draws some graphs.

Now i have to show this user control in a Silverlight application (to show on ASP.net webpage). Is this possible to use a WPF user control in a Silverlight application?

I have searched on Google, but have not found a satisfactory answer.

No, it is not possible to show a WPF control in Silverlight. They use two different runtimes so are not directly substitutable with each other.

You have a few options though:

Edit:
in response to your comment you seem to have some misunderstandings, I think you haven't understood the links I gave you. You may also have misunderstood what Silverlight is - just in case you have let me mention that Silverlight runs as a plugin within the web page, it isn't directly part of the HTML structure.

For the XBAP approach the WPF control/page is hosted inside a web page - just like a Silverlight control is. However you don't have direct access to the local filesystem or network filesystem (or databases running on the network) - Silverlight is the same, to access a database you really need to go via a WCF service .

With the second approach you have two versions (one for WPF, one for Silverlight) of your control and you use compile time targeting to dictate which control is built. You then use the appropriate control in the appropriate project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM