WPF: Setting the Width (and Height) as a Percentage Value

前端 未结 7 624
悲&欢浪女
悲&欢浪女 2020-11-27 10:59

Say I want a TextBlock to have its Width equal to it\'s Parent container\'s Width (ie, stretch from side to side) or a percentage of

7条回答
  •  爱一瞬间的悲伤
    2020-11-27 11:22

    You can put the textboxes inside a grid to do percentage values on the rows or columns of the grid and let the textboxes auto-fill to their parent cells (as they will by default). Example:

    
        
            
            
        
    
        
        
    
    

    This will make #1 2/5 of the width, and #2 3/5.

提交回复
热议问题