How to get button content to fill width in WPF

后端 未结 2 590
面向向阳花
面向向阳花 2020-12-19 01:52

In the following XAML the button will stretch to fit the width of the window, including as you resize the window. However, the TextBlock and blue box are centered. How wou

2条回答
  •  别那么骄傲
    2020-12-19 02:15

    You could also set the HorizontalContentAlignment to Stretch on the Button itself.

    This will tell the content to fill the horizontal space available on the button.

    
    
        
            
        
    
    

提交回复
热议问题