Prevent user from resizing columns with WPF ListView

后端 未结 5 1679
慢半拍i
慢半拍i 2020-12-06 04:27

How can I prevent a user from resizing GridViewColumns withing a ListView control?

5条回答
  •  长情又很酷
    2020-12-06 05:05

    For those looking for a quicker and simpler answer.

    Set IsEnabled to False in the ColumnHeaderContainerStyle. This will prevent the user from resizing.

    Like this:

    
      
    
    

    If you want to fix the disabled grayed out color add a trigger on the IsEnabled property and fix what you need.

    
       
    
    

    This answer might not be as elegant as other posted; but in my case all I needed was a quick way of doing it.

    Hope this helps someone.

提交回复
热议问题