How do I enable text wrapping on all column headers?

前端 未结 5 1096
无人及你
无人及你 2021-01-03 18:14

How does one enable text wrapping on all column headers of a DataGrid, without disabling the other default header functionality? Such as column resizing, sort d

5条回答
  •  时光取名叫无心
    2021-01-03 18:35

    Instead of assigning the column name directly to the DataGridColumn.Header property, I created a TextBlock containing the column name, set the TextWrapping property of the TextBlock to "Wrap" and assigned the TextBlock to the DataGridColumn.Header property. This preserves the default header functionality.

    Example:

    
        
            
        
    
    

提交回复
热议问题