Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use Silverlight with AJAX without any UI element?

I know you can just use CSS to hide the DIV or Silverlight Plugin, but is there a way to instantiate a Silverlight Component/App using JavaScript that doesn't show any UI element at all?

There is alot of great functionality in Silverlight, like MultiThreading and compiled code, that could be utilized by traditional Ajax apps without using the XAML/UI layer of Silverlight at all.

I would like to just use the standard HTML/CSS for my UI layer only, and use some compiled .NET/Silverlight code in the background.

like image 266
Chris Pietschmann Avatar asked Nov 01 '25 20:11

Chris Pietschmann


2 Answers

Yes you can, and some of the reasons you make makes perfect sense. I did a talk on the HTML bridge at CodeCampNZ some weeks back, and have a good collection of resources up on my blog.

I also recommend checking out Wilco Bauwers blog for lots of detail on the HTML bridge.

Some other scenarios for non visual Silverlight:

  • Writing new code in a managed language (C#, Ruby, JScript.NET, whatever) instead of native (interpreted) JavaScript.
  • Using OpenFileDialog to read files on the client, without round-tripping to the server.
  • Storing transient data securely on the client in isolated storage.
  • Improving responsiveness and performance by executing work in the background through a BackgroundWorker or by using ordinary threads.
  • Accessing cross-domain data via the networking APIs.
  • Retrieving real-time data from the server via sockets.
  • Binding data by re-using WPF's data-binding engine.
like image 84
Jonas Follesø Avatar answered Nov 04 '25 09:11

Jonas Follesø


Yes. I think this is particularly intriguing when mixed with other dynamic languages -- but then, I'm probably biased. :)

Edit: But you'd need to use the managed Javascript that's part of the Silverlight Dynamic Languages SDK and not the normal Javascript that's part of the browser.

like image 22
Curt Hagenlocher Avatar answered Nov 04 '25 09:11

Curt Hagenlocher