How to use the Binding DataGridTextColumn inside CellStyle, ElementStyle and EditingElementStyle in WPF
02:54 17 Jun 2025

I would like to modify the Template of the CellStyle, ElementStyle and EditingElementStyle of the DataGridTextColumn (and also DataGridComboBox and DataGridTemplateColumn later on).

Let's say I have the following column:



    

        

            

                

            

        

    


I don't really know what is the difference btw. CellStyle and ElementStyle, but I would rather consider the EditingStyle here. Note that I've prefixed the the key name with MyProperty because I don't know yet how to "reuse" the binding of the DataGridTextColumn inside the Template of the EditingElementStyle.


I tried to directly bind the Text property of the CustomTextBox with RelativeSource to the DataGridColumn, but I get errors such as "A two-way binding requires a Path or XPath".

I'm sure that I'm missing something.

wpf binding datagridcolumn elementstyle