How to set property of a Siverlight control from .aspx.cs page?
Here is my code
public partial class MainPage : UserControl
{
public MainPage()
开发者_如何学JAVA {
InitializeComponent();
}
public string CurrentPage { get; set; }
Now I want to set the CurrentPage value from my .aspx page load event?
Thanx
if you want to pass in parameters into a Silverlight application from your calling web page you have to specify and assign the parameters inside the <object ... />
tag that you're using to embed the Silverlight app.
An example for such a parameter could be:
<object data="..." type="...">
<param name="Parameter1" value="Value1" />
</object>
Inside the Application_Startup
method (App.xaml.cs) you can query these parameters from the StartupEventArgs' InitParams collection.
If you just want to the get the hosting URL you can use this property from everywhere inside your Silverlight application:
System.Windows.Browser.HtmlPage.Document.DocumentUri
精彩评论