WPF Datagrid binding custom column headers

后端 未结 3 1601
一个人的身影
一个人的身影 2021-02-03 12:22

I am trying to figure out how to bind a WPF DataGrid\'s column header and main data to a data source using an MVVM pattern. The result I\'m looking for would look like this:

3条回答
  •  半阙折子戏
    2021-02-03 12:41

    We do something similar in our app.

    What i have done is derived my own column type (DataGridSearchableBooleanColumn), then i replace the DataGridColumnHeader template, i put two content presenters in there. the first i bind to the content (the same as the default template) the second i bind to the column. I use a data template for the column (i have a few of them for different search types (text, combo, boolean). then i add the extra properties to the column so i can bind to them. See if this code makes sense.

       
       
                         
                      
                      
                         
                            
                         
                      
                   
                
             
          
       
    

提交回复
热议问题