How to reuse WPF DataGridTemplateColumn (including binding)

后端 未结 2 1157
梦如初夏
梦如初夏 2021-01-01 17:46

In WPF datagrids, I have a column defined as DataGridTemplateColumn which I\'ll need to be using on all kinds of columns. As a very simplified example please consider the b

2条回答
  •  情书的邮戳
    2021-01-01 18:23

    You can set the CellStyle property to a style that overwrites the Template for the DataGridCell.

    In the Template, use a ContentPresenter that is bound to the TemplatedParent.Content wherever you want to place the DataGridCell's Content, since the TemplatedParent is the DataGridCell

    For example,

    
    
    
        
            
                                
        
    
    

提交回复
热议问题