Rotate WPF control or change screen orientation -


i have wpf project 1 window (mainwindow). depending upon config file shows 1 of 2 usercontrol's content. may horizontal (1920x1080) control or vertical (1080x1920) control. it's fine horizontal screen, when vertical loaded do:

1) rotate window/control 270 degrees 2) change primary screen orientation

i prefer rotate application , don't interact windows api. can't change orientation manually, because have remote access computer.

you can not rotate window object itself, positioned window management system built in windows. can, however, transform (and rotate) frameworkelement inside window. includes, not limited to, grid, button , textbox elements.

all need edit layouttransform property on element want rotate, root element in window. set rotation 270/-90 degrees , wpf automatically rotate ui.

because using layouttransform property, layout system scale ui correctly. rendertransform property causes control first rendered, rotated.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -