WPF调整大小窗口从下到上 [英] WPF Resize Window from Bottom to top

查看:83
本文介绍了WPF调整大小窗口从下到上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确实需要有关此问题的帮助,我到处搜索但似乎找不到答案.我有一个高度设置为66的窗口.在后面的代码中,窗口底部有一个按钮.当用户单击此按钮(this.height = 400)时,窗口的大小将自下而上增大.但它从左上角开始增长.请帮助:(

I really need help for this questions, I search everywhere but can't seem to find an answer. I have a window with the height set to 66. In my code behind I have a button on the bottom of the the window. when the user clicks this button(this.height = 400), the size of the window is to grow from bottom up. but it grows from left top corner. please help :(

推荐答案

我认为您需要更改控件在窗口中的锚定方式.默认情况下,它们将锚定在左上方,因此,当窗口大小更改时,控件将不会移动.如果将a控件锚定在底部,则当窗口扩大时,该控件将相应地向下移动.

I think you need to change how the controls are anchored in the window. They are going to default to anchoring to the top left, so when the window size changes, the controls will not move. If you anchor the a control to the bottom, then when the window grows, the control will move down accordingly.

这篇关于WPF调整大小窗口从下到上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆