How can a reference link to a silverlight xaml control make a delegate reachable from another project or visa-versa?


  • Using Visual Studio 2008: 

    First I can create a silverlight website, and make an xaml page (by default Page.xaml) with a code-behind file written in C#.
    Second I can create a seperate project of type ASP.NET 3.5 Extensions Web Application, with a default.aspx of type AJAX Webform.
    Third I create a link from my second project to the first project (rightclick second project) and choose for Add Silverlight Link.

    So far, we have the projects linked to eachother, and the second project shall take the .dll and the xaml pages from the silverlight project.

    Now my question:
    The Page.xaml as a code-behind written in C# (in my case). The default.aspx in the second project has a reference to the xaml page as follows:<asp:Silverlight ID="Silverlight1" runat="server" Height="100%" Width="100%" Source="~/Page.xaml" />

     Is it possible that I can create a delegate inside the Page.xaml.cs with an event, and use it in default.aspx.cs? I need a reference to the Page.xaml from the first project. The only reference I have is the ID="Silverlight1" and that reference has no possibility to get access to the code-behind from Page.xaml to connect a methode to this delegate / event.

    I hope some of you can help me out.


    Monday, January 07, 2008 4:42 AM


  • Silverlight and project execution scope are different. For ex: codes in default.aspx.cs is executed in the server side but the code in silverlight project executes in the client machine.

    but if you want to invoke any server side function (i.e. default.aspx.cs or webservice method) you can still do that in ajax way. You can either call web service from silverlight app (i.e. page.xaml.cs) or you can even do it with javascript.


    Tuesday, January 08, 2008 1:02 PM