WPF Resize Window from Bottom to top

你说的曾经没有我的故事 提交于 2019-12-11 03:44:00

问题


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 :(


回答1:


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.




回答2:


Your description sounds to me as if you want to decrease the Top property value of your WPF Window by the same value that you increase its Height, or rather its ActualHeight effectively.

There is also an Expander control in WPF that you might find useful.




回答3:


Thank you everyone for your answers. I finally solved this issue by using a popup. I attached it to the top of the window and when its height is increased, it increases from bottom up.

Popup Text



来源:https://stackoverflow.com/questions/28512395/wpf-resize-window-from-bottom-to-top

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!