TextBox expanding with surrounding Grid but not with text

前端 未结 3 858
我寻月下人不归
我寻月下人不归 2021-02-20 09:21

A window has a Grid with two columns. The left column contains a control with a constant width but with a height that adapts. The right column contains a TextBox that takes up a

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-20 10:10

    The answer is based on Leom's answer.

    The solution works great when you enlarge the window, but the resizing is not smooth when you make the window smaller. As the textbox participates in the grid's layout, it has to perform layout process multiple times. You can fix that by putting the texbox in the canvas, so the change of the size of the textbox no longer triggers the grid's re-layout.

    The updated code:

    
    
        
    
    

提交回复
热议问题