HorizontalAlignment=Stretch, MaxWidth, and Left aligned at the same time?

前端 未结 8 2443
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 14:47

This seems like it should be easy but I\'m stumped. In WPF, I\'d like a TextBox that stretches to the width of it\'s parent, but only to a maximum width. The problem is that

8条回答
  •  孤街浪徒
    2020-12-04 15:29

    You can set HorizontalAlignment to Left, set your MaxWidth and then bind Width to the ActualWidth of the parent element:

    
         
        
      
    
    

提交回复
热议问题