All I really want to do is change the StringFormat
for a particular binding on a DataGridTextColumn
, but since that is defined by the binding, I suppose that I need to change the entire binding somehow.
The reason that I want to avoid using a DataGridTemplateColumn
is because the DataGridTextColumn seems to have some built-in base functionality that I would lose and have to write code to handle more manually, such as:
- The ability to start typing into a non-edit mode cell which puts the cell automatically into edit mode
- Copying and pasting of data (from within the DataGrid and from Excel)
Current Binding (Desired Display/Read Mode Binding)
Binding="{Binding ADecimalNumber StringFormat={StaticResource ReadDecimalFormat}}"
Desired Edit Mode Binding
Binding="{Binding ADecimalNumber StringFormat={StaticResource WriteDecimalFormat}}"
Just as an FYI, the ReadDecimalFormat
is to display the decimal value with 2-digits of precision, and the WriteDecimalFormat
is to display the original decimal value entered (all-digits of precision, most cases this is 4-digits)