How do I tell if the browser window is Maximized in Silverlight/C#?
How do I tell if the browser window is Maximized in Silverlight/C#?
The "Form" maximize feature will not work because I am writing a silverlight app that runs in the browser.
I have tried this:
App.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged);
but this event handler is not called when I maximize the window.
Maximized is not full screen
App.Current.Host.Content.IsFullScreen;开发者_如何学Go
returns false even if I maximize the window.
The browser does not pass that kind of information down to its content.
You can probably detect a resize event and then compare the browser window size with the screen size with some tolerance for the browser borders... however you will never be able to be sure if that is maximized.
The IsFullScreen is unrelated to browser size. Think of that being more like when you make your media player full-size (the smaller window still exists under it).
Here is a link showing various properties of the browser you can access with Silverlight. It is old but still relevant:
http://www.jeff.wilcox.name/2008/06/browserscreeninformation/
精彩评论