0

I know that if I want the screen to be maximized on any screen I can just:

this.WindowState = WindowState.Maximized;

But I have a WPF app that has 1300x500 resolution. On my full HD monitor it looks delightful. But on my notebook, not so much. I want it to have a proportional to 1300x500 size, but how do I do that? Tried out "locking" the app boundries as I was told but not working. Can I do something like get the screen resolution of the computer on which the program is running and set a default size?

M. Adeel Khalid
  • 1,786
  • 2
  • 21
  • 24
  • 1
    Did you check [this SO question](http://stackoverflow.com/questions/254197/how-can-i-get-the-active-screen-dimensions) - maybe you can use that to get the current screen dimensions and then set the resolutioon of your app accordingly – Bassie Jan 18 '17 at 16:22
  • Seems promising. It can fill the hole for my problem. I could calculate the app size given the resolution of the screen. I'll leave my question open for a little longer, if anyone has the answer for if I can adjust it automatically. But thanks! –  Jan 18 '17 at 16:24

1 Answers1

2

Try wrapping your content in a ViewBox and set the size to your target resolution. On the varying resolutions, the app will scale.

Eric
  • 1,737
  • 1
  • 13
  • 17