如果要让一个SL控件布满它的父亲容器,那么要去除它的所有位置设定属性(如:左对齐等也算)
如果要让一个SL全屏(看不到IE的框框)那么用:
System.Windows.InteropBrowserHost.IsFullScreen = true;
恢复:System.Windows.InteropBrowserHost.IsFullScreen = false;
另外一种方式:
Content contentObject = Application.Current.Host.Content;
contentObject.IsFullScreen = true;
因为在全屏的时候会出现一个提示:要复写掉它可以这样的
Application.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged);
实现事件处理
private void Content_FullScreenChanged(object sender, EventArgs e) { Content contentObject = Application.Current.Host.Content; if (contentObject.IsFullScreen) { toggleButton.Background = new SolidColorBrush(Colors.Green); toggleButton.Content = "Full Screen Mode"; } else { toggleButton.Background = new SolidColorBrush(Colors.Red); toggleButton.Content = "Normal Mode"; } }