WPF TextBox won't fill in StackPanel

后端 未结 4 1413
無奈伤痛
無奈伤痛 2020-11-29 03:55

I have a TextBox control within a StackPanel whose Orientation is set to Horizontal, but can\'t get the TextBox to fill t

4条回答
  •  春和景丽
    2020-11-29 04:23

    I've had the same problem with StackPanel, and the behavior is "by design". StackPanel is meant for "stacking" things even outside the visible region, so it won't allow you to fill remaining space in the stacking dimension.

    You can use a DockPanel with LastChildFill set to true and dock all the non-filling controls to the Left to simulate the effect you want.

    
        
        
    
    

提交回复
热议问题