2009-12-04 16 views
2

因此,據我所知,在Sharepoint中使用Silverlight時,我需要給Web部件一定的高度和寬度以適合我想要使用的Silverlight應用程序。而且我不能在Web部件屬性中使用100%。Silverlight應用程序在共享點的動態高度

我想要做的是Silverlight應用程序告訴webpart什麼高度應該是。

目前我甚至不確定如何計算silverlight應用程序的所需高度,高度取決於應用程序中加載了多少數據。但是如果我可以在Sharepoint中設置高度,那麼它甚至毫無意義!

對任何一點的幫助都很好。

乾杯

回答

0

調用JavaScript函數時,你的主X:電網負荷,做大小調整爲您提供:

<Grid x:Name="LayoutRoot" Loaded="LayoutRoot_Loaded" .../>

在您.xaml.cs:

private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) 
{ 
    HtmlPage.Window.Invoke("fixWebPartHeight", LayoutRoot.ActualHeight); 
}

和你頁面腳本(jQuery示例)

function fixWebPartHeight(height) 
{ 
    // set an unique id wrapping the content of your webpart 
    $("#myCustomWebPart").height(height); 
} 
相關問題