Skip to main content
Home Forums Silverlight Programming Programming with .NET - General How to use SL 1 in SL 2 application
2 replies. Latest Post by Yi-Lun Luo - MSFT on August 11, 2008.
(0)
silverbyte
Participant
1338 points
405 Posts
08-08-2008 11:59 AM |
Hello,
I have the application written in JavaScript in SL 1 and now I want to make the application accessible from a SL 2 application to enhace it (use the SL 2 controls)
I created a SL 2 application and I am trying to call an entry point function of SL 1 application JavaScript code:
I need to pass plugin and rootelement but I don't know if it's possible.
I do this:
// Page.xaml.cs
public partial class Page : UserControl { public Page() { InitializeComponent(); } public void Run() { HtmlPage.Window.Invoke("createScene", HtmlPage.Plugin); // i need to pass plugin and root element } }
in App.xaml.cs:
private void Application_Startup(object sender, StartupEventArgs e) { Page page = new Page(); this.RootVisual = page; page.Run(); }
in BLOCKED SCRIPT
function createScene(plugin, rootEleement)
{
// run SL 1 code using plugin and rootElement}
How can I use SL 1 code in SL 2 application ?
I need to have only one Silverlight plugin in the page which content will be modified both from C# and JavaScript.
What I am thinking is to make the SL 2 application as the 'host' which creates the root element which SL 1 code will use.
Is it possible ?
Thank you.
Shaji-mji
1129 points
260 Posts
08-11-2008 2:39 AM |
SL1 will work with SL2 beta 2 plugin. So its possible to use the same code..
Yi-Lun L...
All-Star
25052 points
2,747 Posts
08-11-2008 3:42 AM |
Hello, the programming model of SL1 and SL2 are completely different. There's no way to "enhance" an SL1 application with SL2 unless you completely discard the new programming model, and use the old XamlReader.Load way. You have the following options: