In this Tips & Tricks, I will show you the steps by which you can get the Screen Resolution of Client’s PC in Silverlight Application. I...
-
Published by Kunal Chowdhury
In this Tips & Tricks, I will show you the steps by which you can get the Screen Resolution of Client’s PC in Silverlight Application. It is quite simple. You have to just call the HTML DOM object to receive the handle of the screen and from that you can easily get the Screen Resolution.
To get the Screen Resolution, you need to get the handle of the Window and you can get it from:
Now from that object, you can call the Eval() with proper parameter “screen.width” or “screen.height” to get the Screen Width or Screen Height respectively. Those will give you the Screen Resolution. Suppose, you received Width = 1024 & Height = 768, means your Screen Resolution is: 1024 x 768.
Here is the complete code:
From the above code, you can easily understand how we are collecting the Screen Resolution of the user’s screen. Hence, use it whenever you need.
Solution Architect & Former Microsoft MVP
Kunal Chowdhury is an enterprise solution architect and former multi-year Microsoft MVP. He is the author of three technical books: Windows Presentation Foundation Development Cookbook, Mastering Visual Studio 2017, and the Mastering Visual Studio 2019.
He publishes technical articles on Kunal-Chowdhury.com.