[英]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.