How to resize WPF DataGrid to fit its content?

前端 未结 5 1842
别那么骄傲
别那么骄傲 2020-12-28 14:47

The aim

I would like to set such size for the DataGrid (standard, from WPF) so all cells (text) would be fully visible. I have window with DockPanel, with DataGrid

5条回答
  •  再見小時候
    2020-12-28 15:48

    In my case, I found DataGrid use HorizontalAlignment="Stretch" VerticalAlignment="Stretch" in default, So I set it to

    
    

    Then works.

提交回复
热议问题