views:

474

answers:

3

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.

+1  A: 

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.

Curt Hagenlocher
Curt, using Managed JavaScript would still require you to have some Silverlight/XAML display layer being visible on the page, correct? Is there a way to entirely get rid of any Silverlight/UI element from being displayed?
Chris Pietschmann
A: 

Curt, using Managed JavaScript would still require you to have some Silverlight/XAML display layer being visible on the page, correct? Is there a way to entirely get rid of any Silverlight/UI element from being displayed?

Chris Pietschmann
nope you can call out to the document object and manipulate the DOM
Brian Leahy
+3  A: 

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.
Jonas Follesø
"Storing transient data securely on the client in isolated storage"Isolated storage is done in plain text. You have to do your own encryption.
Brian Leahy