Reputation: 311
I am having trouble making my WPF window resize in a different direction. Currently, when I shoot an event in my application, application resizes down (I make an element visible and then WPF window automatically resizes). I would like that my application would instead resize up, so that the application would not become hidden by a taskbar. How does one do that?
Below is a picture explaining my problem. Picture 1 shows small window. Picture 2 shows the problem, where window resizes beyond the screen. Picture 3 shows what I want to do.
I can surely code this resizing in my code, where I would move the window, but is there not a nice way in WPF?
Upvotes: 1
Views: 1069
Reputation: 6046
Changing the Width
or Height
property of your window will always change the layout of it to the right or bottom.
The Left
and Top
property of the window determine the X- and Y-Offset of your window relative to the top-left corner of your screen.
To achieve your goal, you have to do 2 steps:
Height
by the amount of XTop
by the amount of XUpvotes: 1