How to make textbox resize as the window resize

前端 未结 4 1059
小鲜肉
小鲜肉 2020-12-06 05:15

Any property to set to make textbox to resize according to the window size?

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 06:03

    It could be little tricky because of few constraints.

    1. Text box you cant put width auto (in my case if some one copy paste long string it goes out of boundary because of Auto Width).
    2. I can't keep it default because in case of no text it's very small in width, So I needed MinWidth.
    3. At the same time you have to have a static width representation, because we want to wrap the text for particular line.

    I tried this solution which makes your width bounded to parent ( I agree there could be better solutions as well, but this was easy and worked fine)

    
        
          
          
        
        
          
        
        FIX message... 
         

    So only good thing I did was, I binned the

    Width= "{Binding ElementName=LeftColumnDefinition, Path=Width}"

    to

提交回复
热议问题