silverlight后台代码:
using System.Windows.Browser;
public
Page1()
{
HtmlPage.RegisterScriptableObject("PageModel",
this);
InitializeComponent();
}
[ScriptableMember()]
public void
SetMargin(long left, long top, long right, long bottom)
{
Thickness
margin = new Thickness(left, top, right, bottom);
this.控件名称.Margin
= margin;
}
js 代码:
function setMargin() {
var silverlight =
document.getElementById("silverlight"); //
引用silverlight的object
silverlight.Content.PageModel.SetMargin(1, 2, 3, 4); //
js调用silverlight方法
}
.net后台 Silverlight 页面 动态设置 ASPX 页面 控件的Margin值(位置设置),布布扣,bubuko.com