I have a WebBrowser control showing a Silverlight application. This control is in a WPF application. Obviously this is a bit of a hack to integrate Silverlight with WPF as ultimately neither one knows about each other, they're completely independent.
So what I need is for Silverlight to post a value into the WPF application. What I was thinking was using JavaScript hosted in the .aspx page in the Silverlight application which can be accessed from both Silverlight and WPF. I think it is fairly simple getting data from Silverlight to the .aspx page but I'm not sure how to get the data from the .aspx page to WPF. Ideally I don't want WPF to have to call for the data, I want it to be posted from Silverlight and appear in the WPF application without WPF having to do anything except receive and display the data.
Hmm...hope that makes sense.
Silverlight to/from JavaScript: see here
MSDN - Making Silverlight Scriptable by JavaScript
WPF to/from JavaScript: see here
Stack Overflow - Invoke C# code from JavaScript in a Document in a WebBrowser
Code project - Working with webbrowser in wpf
Related
kindly tell if there is any way to solve the connectivity of the vcsharp with asp.net. as i am trying to run the c# windows form application on asp.net to make my website more knowlodge able. Is there any other connevtivity option besides aspnet.
You can run web application in windows Forms application. You may embed the WebBrowser control. It makes sense, but if you want to run desktop application in a asp.net web this doesn't make sense IMO.
If you want to benefit from Rich Controls behaviors, you have web widget available within jQuery UI, BootStrap, etc.
Don't mix things
EDITS: According to your first comment, I'd suggest you to search for the web sdk for arcgis or an equivalent. Or You may need to reference dll available in the SDK and use web controls to display data
Plz read this
I want to run my WPF application on asp.net web application. Actually I have a WPF page.xaml which contain the image viewer, which actually open image and edit it as required.
Now I want to embed that in my Asp.net Web application. I have a asp.net web application user control on which I want that WPF stuff. I research on it on the internet, I find a way that we first publish the WPF application on the IIS server and then past the URL in asp.net web application page iframe. as I follow this below link:
http://msdn.microsoft.com/en-us/library/aa970060.aspx#deploying_a_xbap
now I not want to follow this approach. I want an alternate way of this. Is there any way to handle this scenario. If yes then how can we achieve this?
Yes there's a better way: you can use Silverlight (basically it's a C# equivalent to Flash).
Even if Silverlight is quite the same as WPF, there is some differences due to the fact that silverlight is made for web. So you'll have to make some changes to your application.
About integrating it in your page, it seems quite simple:
You can use an object html element (as you would do with Flash)
Here are some links about that:
http://msdn.microsoft.com/fr-fr/library/cc838145(v=vs.95).aspx
http://www.c-sharpcorner.com/uploadfile/raj1979/host-silverlight-in-Asp-Net/
2 years later, a possible answer appears! Maybe someone else will see this and get some use out of it.
I have been hearing rumors that it is possible to run your WPF application in a browser, it's called an XBAP?
https://msdn.microsoft.com/en-us/library/aa970060%28v=vs.110%29.aspx
I am about to give this a try myself, I'll update this answer with any limitations I find.
We have a web application that can be tested using Selenium, but that's not enough because the web application will be used inside a WinForms application using the Web Browser control.
The WinForms app interacts with the content of the page hosted inside the Web Browser Control and viceversa.
We have tests on other layers like services, but we need to find a way to test the WinForms UI that interact with the Web Browser control.
Any suggestion?
In addition to the link which Myles kindly provided, I also blogged specifically about calling the WebBrowser control from C# WinForms applications here:
http://matthewskelton.wordpress.com/2007/04/21/calling-javascript-from-c/
Specifically, you can use Type.InvokeMember() to call JavaScript from C#.
In terms of testing this, I suppose you'd need to drop a JavaScript listener/logger into the DOM, hooking it onto a low-level event or prototype, and then log out to the JavaScript console.
What you need is a WinForm test automation. A friend of mine blogged about this recently; http://matthewskelton.wordpress.com/2012/01/08/test-automation-tools-for-winforms-desktop-applications/
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 wondering 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
I am relatively new to Silverlight development and I am trying to figure out how to get data out of a silverlight control that I have made.
I have a Silverlight control that gathers a bunch of graphical data points. The Silverlight control is embedding in a asp.net webforms application. The page that is displaying the control also does other data specific functions and when the user clicks a button I need to perform some manipulation of the data (both webform data and the data contained in the Silverlight control) and then save the data with 1 call to the DB.
My question is how do I get the data out of the Silverlight control from my webform to be able to put the data together for the save?
My initial thought was to make the data in the Silverlight control accessible via Javascript and then on the button click, save the Silverlight control's data to some html control and then allow the regular webform post to occur and read the data server side. Is there a better way to do this as it feels a little messy.
Note: I am using .NET 3.5 and Silverlight 3.0.
You have a lot of options:
You can have your Silverlight control submit the data directly to the server, using ADO.NET Data Services or a webservice call which processes the data
You can use RIA Services, which simplifies the process of interacting with server-side code from Silverlight
You can have the Silverlight control update a form field (hidden, probably) which then can be processed and submitted via the web page
Marc Gravell's protobuf-net library for silverlight may be an option for server side comms. Googles protocol buffers can comunucate with lots of lauguages.