0

I don't want to let my users change the window size horizontal and vertical. The only way they should resize the window is diagonally.

Is there a way to do this?

Thanks in advance.

EDIT 1: Content scaling, maintaining proportions?

user3004449
  • 129
  • 1
  • 15
  • 1
    possible duplicate of [Resize a WPF window, but maintain proportions?](http://stackoverflow.com/questions/2471867/resize-a-wpf-window-but-maintain-proportions) – myermian May 03 '15 at 17:37
  • 1
    Not sure if you are just looking to keep things proportional or not, but that's the only thing that makes sense if you limit them to diagonal expansion, since normally expanding from the corner would allow the user to increase only vertical or horizontal as well, making the requirement useless. – myermian May 03 '15 at 17:38

1 Answers1

1

If you want an easy solution without hooking Windows API you could add an event handler to SizeChanged and resize to the aspect ratio you like.

Downsides:

  • Not interactivly for the user
  • You have to determine between user-resize and your resize in the handler
  • The Windowhas to render the layout twice, one might be unexpected

But depending on your scenario this might be sufficient.

ZoolWay
  • 5,411
  • 6
  • 42
  • 76