1

I created another WPF project in my asp.net project solution and now want to use my WPF controls in my web application. Is it possible to use wpf control in my web projects?? I figure out on internet some says like you have to use Silverlight for web applicaitons. As far I know silverlight is subpart of WPF, so why not i can use WPF??. I have to use WPF controls because already did enough efforts to build wpf controls and now wanna to use in Web application.

vitall
  • 153
  • 1
  • 3
  • 12
  • WPF is a framework. Silverlight is a plugin. Both are very different. You may find them similar because of XAML, but they are governed by very different principles. – StaWho May 02 '13 at 08:12
  • @StaWho silverlight is not a plugin, silverlight uses a plugin as a proxy to the .net runtime. – MeTitus May 02 '13 at 08:29
  • @Marco Call me daft, but which version on .NET Runtime does Silverlight use on MACs, or which version does Moonlight use on Linux? – StaWho May 02 '13 at 08:57
  • @StaWho, I did not say the .NET Framework, I said .NET runtime. For linux you have mono, for Mac you have something else. – MeTitus May 02 '13 at 09:02

6 Answers6

2

Yes, you can embed WPF controls in a webpage, but you'll need the relevant plug-in enabled (much like Silverlight).

As an example the Xceed Datagrid for WPF is viewable within Internet Explorer.

Xceed Datagrid with Internet Explorer

Although XAML applications are disabled by default, you'll need to enable them in your Internet Explorer security settings.

Internet Explorer Security Settings

As for Firefox, you'll need both the .Net Framework Assistant, and WPF Plugin as suggested by MSDN.

WPF is a really great framework, and enabling WPF/XAML based applications for intranet usage would be fine (you could inherit the security permissions through group policy), or for a set audience who don't mind the extra configuration.

wonea
  • 4,783
  • 17
  • 86
  • 139
0

No you cannot use WPF in a web page. WPF is for Windows Applications and will only run on Windows machines. The internet is device agnostic and will run on Windows, Linux, Android, iOS etc. Therefore you need to use ASP .NET (or similar) for web applications and WPF for Windows.

Silverlight is a sub-set of WPF and will work on a web page... BUT not all devices support it (i.e. iOS). So if you really want to be system agnostic and true to the spirit of the web use HTML / CSS and JavaScript.

Belogix
  • 8,129
  • 1
  • 27
  • 32
  • He cannot use WPF in a web page but he can surely host silverlight apps in a web page. – MeTitus May 02 '13 at 08:14
  • @Marco - Yes, I have clarified he **COULD** use Silverlight but it won't work on all devices. He hasn't stated exactly where it will be used so I highlighted that Silverlight will work but to bear in mind that it won't work everywhere, HTML etc will. Silverlight is great as LOB but not for most anyway application IMHO. – Belogix May 02 '13 at 08:25
  • He was thinking about using wpf in the first place, so I don't think he is worried about that, but maybe he did not know it either. – MeTitus May 02 '13 at 08:32
0

The only way you can achieve that is by using Silverlight components not WPF. As you said silverlight is a subset of WFP, so not all WPF features are supported but the silverlight runner. For the most part, the visuals are fully compatible, that is user controls, so if you did not use anything that is specific to WPF then you should be grand.

maybe check here:

WPF vs Silverlight

BTW can you post your xaml, so that we get an idea?

Marco

Community
  • 1
  • 1
MeTitus
  • 3,390
  • 2
  • 25
  • 49
0

I believe you can use the XML WPF Browser application to do this, but I'd probably not recommend it, as I think your users will have to download client-side components in order for it to run. The following link gives more info.

http://msdn.microsoft.com/en-us/library/aa970060.aspx

Andrew
  • 2,315
  • 3
  • 27
  • 42
0

Although there are ways to do this (already mentioned by other users on this page), relying on your visitors to have this configured or plugins installed in their browsers means it's very risky to implement this (assuming your target is the WWW and not just local users).

I would consider building a web application UI and just reference everything via class libaries (if using N Tier design)

Dave
  • 8,163
  • 11
  • 67
  • 103
0

Whatever it is possible or not, the using of WPF controls embedded in a html page is just horrible.

A classic WPF control might be running (after changed browser settings), but there are many security concerns. Furthermore you have to show your users a to do list before anyone could see the real page.

Silverlight as a subset of WPF, but it is also a plugin that is not available for all platforms such as, for instance, iOS.

I recommend to use HTML 5, which is a per se standard and viewable on all other platforms. It causes more effort, but is is definitely worth it.

Kai
  • 1,953
  • 2
  • 13
  • 18