integrate WPF with ASP.NET - asp.net

Is it possible i can use WPF in ASP.NET application. if so, how can i create an ASP.NET web site with WPF.
Thisng is, i have created a website through visual studio. Then i was trying to add a web page as WPF. But i couldnt. I am very new to WPF. Please help me. Is it WPF is only for winform application? We could not add WPF in web forms?
Regards

WPF (Windows Presentation Framework) is primarily a desktop technology. It is possible to embed a WPF application inside a web page as a XBAP (XAML Based APlication) but that is different than creating pages with WPF.
Silverlight is the framework to chose if you want to build a Rich Internet Application. Is has better integration with the pages that it is embedded on as well as any Javascript on that page.
Both WPF and Silverlight use XAML and a common set of controls so Silverlight should be somewhat familiar.

WPF can be placed inside an ASP.NET page (or any other web technology) with the browser's WPF Plugin (or ActiveX for Internet Explorer), called XBAP.
But WPF is a large set of components and need the .NET Framework installed on the user machine to work. In other words, the plugin just place the WPF content on that position and calls the .NET Framework to load there.
The closest approach is to use Silverlight, wich is a small subset of WPF components, fully based on browser's plugin (like Flash does). It has less "things" than the full WPF API, but is very good for most uses.
Resuming, Silverlight needs the plugin installed on the users' browser (like Flash needs). And WPF needs both the plugin and also the .NET Framework installed on the users' machine.

Worth mentioning that silverlight RIA will run in IE and firefox (safari etc) on a Windows box and in linux with Moonlight if its compiled to Silverlight 2.0 or earlier (but not yet if its compiled to Silverlight 3 or later).
WPF XBAPS will only run in IE on Windows box.

Related

Porting an IE Extension to a WebAssembly

I have developed an extension for Internet Explorer in C# using Visual Studio .Net 4.5.2 Framework which I would like to port to Chrome & Edge (Chromium). It is quite a sophisticated extension that comprises 6 bespoke C# libraries I have developed which in turn use a number of system libraries including Microsoft.mshtml & System.Windows.Forms. I am hoping that building out as a WebAssembly will prove a viable solution.
I tried porting to .Net 5.0 using Visual Studio 2019 with Windows.Wasm and also using Mono.Wasm but these have simply thrown up a succession of compatibility challenges.
Can anyone recommend alternative approaches I should look at. I am considering trying Blazor (although this appears to be more orientated towards server-side than client-side), Ooui.Wasm and Uno platform.
Regards,
Howard
Blazor has two different types of projects, one is Blazor Server App, which is obviously server side, and another one is Blazor WebAssembly App, which can be used to develop client side browser extension.
I too, has the intention to create browser extension using Blazor and so I created a package to help others achieve the same too. Feel free to checkout my repo on GitHub on how to do it.
This package includes the ability to interact with the WebExtensions API for cross browser compatibility. A browser APi polyfill developed by Mozilla is also loaded so that you can use WebExtensions API in Chrome too.
However in your scenario, with Blazor it is not possible to use WinForms so you will have to convert them to Razor components.

In WPF control - display a UWP app

https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-extend
This explains a process of showing a UWP app in a separate window than the WPF app. Is it possible to display them in the same window? Eg. display the UWP app inside a WPF control. Or even better : display a UWP control inside a WPF control.
Things have changed and Windows now supports hosting UWP controls inside Win32 applications such as WPF or Windows Forms.
You can find documentation on XAML islands and the hosting process on https://learn.microsoft.com/en-us/windows/uwp/xaml-platform/using-the-xaml-hosting-api. The article also references sample apps that should help you get started.
I consulted your issue with our team, and as Steven Wick mentioned:
It is currently not possible to display WPF and UWP UI/controls within the same window. A Desktop Bridge app can contain both WPF and UWP components, but their UI will need to reside in separate windows.
It seems like the UI betwwen WPF and UWP can't be mixed stuff, they may in different technologies.

Asp.Net MVC 4 with Blend for Visual Studio 2012?

I haven't seen so far, but can you use Blend to create (shared) layouts in asp.net mvc 4?
Unfortunately the only HTML you can do in Blend is for building Windows Store apps. Though HTML is HTML in whatever context you use it and it should be theoretically possible to design an HTML site in Blend, it's not build for that. ASP.Net can't be used.
I admit Blend would be an awesome tool for designing regular web applications. and I personally hope there will be support for that in the future.

How to create a mobile version of an ASP.NET web site?

I have a website created using asp and I want to make it accessible to mobile phones, such that a user can use it through his/her cell phone.
I don't have any knowledge of XML or .NET.
How can I do this?
ASP.NET Mobile Web Pages says
"The Microsoft Visual Studio integrated
development environment (IDE) enables
you to easily build ASP.NET
applications that include mobile Web
pages. You can include mobile Web
pages in any ASP.NET Web site
alongside ASP.NET Web pages. In Visual
Studio, you can work with the adaptive
rendering, customization, and
extensibility features of ASP.NET
mobile controls, using the standard
IDE design tools: the page designer,
the Toolbox, the debugger, Source
view, Design view, and more."
Getting Started with ASP.NET Mobile Pages
Some other useful tutorials:
Mobile Web Development with ASP.NET 2.0
Building Mobile Web Applications with .NET Mobile Web SDK & ASP.NET
Introduction to ASP.NET Mobile
Back in the day you would have needed XML to create WAP sites, but no more. Almost all smartphones have reasonably good built in HTML browsers, with standards compliant support for JavaScript and CSS.
I would suggest making a start here:
http://www.asp.net/mobile/

How to develop asp.net mobile application?

how to develop asp.net mobile application? what steps I have to be follow from the beginning. Is there any template provided by Microsoft for visual studio 2008 ? I want to develop this using c# + asp.net in mobile environment.
I think you should look Mobile Web App toolkit. If you use MVC you can make 1 project. I recommend you donĀ“t use mobile controls, they are deprecated.

Resources