How to add a right click context menu to Column Header for a WPF 4 DataGrid?

后端 未结 2 1457
半阙折子戏
半阙折子戏 2020-12-15 22:26

I want the context menu for a DataGrid\'s column headers to be different than the rest of the cells. So using the regular ContextMenu property is not going to work. There is

2条回答
  •  攒了一身酷
    2020-12-15 23:08

    Target a common Style to all DataGridColumnHeaders:

        
             
             
    
             
       
    

    If you want different context menus for different column headers then use triggers:

         
             
             
    
             
             
    
             
       
    

    Hope that helps.

提交回复
热议问题