![](/img/trans.png)
[英]How do I redirect the asp.net page that contains a silverlight app from within the silverlight app?
[英]How do i resize a silverlight app based on its contents?
我有一個簡單的應用,我想在加載內容時更改其大小。
例如,假設我加載了大小為100的圖像。
如何更改用於渲染Silverlight的容器的大小?
解 -
您無需瀏覽頁面,而需要瀏覽器對象。
width = 200;
height = 200;
var host = HtmlPage.Document.HtmlPage.Plugin.Id);
host.SetStyleAttribute("width", width.ToString());
host.SetStyleAttribute("height", height.ToString());
調整容器大小后,您會收到通知:
public Page()
{
InitializeComponent();
App.Current.Host.Content.Resized += (s, e) =>
{
// Place here your layour resize code...
this.Width = App.Current.Host.Content.ActualWidth;
this.Height = App.Current.Host.Content.ActualHeight;
};
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.