在silverlight往往还是有一些获取不到的东西,比如说客户机的ip等的数据.可以通过初始化sl时把参数传入sl中.
1.修改page类
public Page(string passText)
{
InitializeComponent();
txtPass.Text = passText;
}2.修改App.xaml.cs
private void Application_Startup(object sender, StartupEventArgs e)
{
// Load the main control
string passText = e.InitParams["passText"];
this.RootVisual = new Page(passText);
}3.传递参数
方法1: Code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
TagPrefix="asp" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml">
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-567175/ ,如需转载,请注明出处,否则将追究法律责任。