Silverlight:需要在 Application.Current.Host.Content.FullScreenChanged 事件之后
问题:
我正在使用 Silverlight Application.Current.Host.Content.FullScreenChanged 事件来检测用户何时在全屏模式之间来回切换。不幸的是,这个事件似乎在屏幕上的任何内容实际调整大小之前触发。
我需要知道全屏更改和全屏更改完成后各种 FrameworkElements 的 ActualWidth/ActualHeight...有什么想法吗?
Problem:
I'm using the Silverlight Application.Current.Host.Content.FullScreenChanged event to detect when a user switches back and forth between fullscreen mode. Unfortunately it seems that this event fires BEFORE anything on the screen is actually resized.
I need to know the ActualWidth/ActualHeight of various FrameworkElements AFTER the change to and from full screen is complete... Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够通过处理主应用程序窗口的 SizeChanged 事件来获取正确的大小。如果您明确需要知道应用程序是否正在从全屏模式更改为全屏模式,也许您可以在 FullScreenChanged 事件处理程序中设置一个标志 - 例如名为 IsFullScreenChanging 的 bool 属性 - 然后您可以在主窗口,执行您需要执行的操作并重置标志以应对下一个 FullScreenChanged 事件。
CS:
xaml:
You should be able to get the correct size by handling the SizeChanged event of the main application window. If you explicitly need to know if the application is changing from / to full screen mode, perhaps you could set a flag in the FullScreenChanged event handler - e.g. a bool property called IsFullScreenChanging - you could then check this property in the SizeChanged event handler on the main window, do whatever you need to do and reset the flag in anticipation of the next FullScreenChanged event.
cs:
xaml:
上面史蒂夫的正确回答中演示的简单答案是使用:(
作为单独的简洁答案添加,以方便未来的读者......)
The simple answer demonstrated in Steve's correct response above is to use:
(Adding as a seperate concise answer for the convenience of future readers...)