WPF: Aligning the base line of a Label and its TextBox

前端 未结 5 1765
梦如初夏
梦如初夏 2021-02-03 20:26

Let\'s say I have a simple TextBox next to a Label:


    
        
5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-03 20:33

    This behaviour is, I think, caused by the fact that the TextBox defaults to a vertical alignment of Stretch, which causes it to fill the available space and have the extra couple of pixels under the text. If you use this instead:

    
        
            
            MyText
        
    
    

    ... you should see a cleaner result.

提交回复
热议问题