Special characters in column names are not parsed correctly by the binding path parser.
So, binding a column to 3/4 is actually only a binding to property 3 , not to property 3/4 . (Same thing with binding . )
You will probably see binding errors in the debug window at runtime, which should say the same thing.
System.Windows.Data error: 40: BindingExpression path error: Property '3' not found in 'object' '' DataRowView '
In accordance with this answer
There are several different characters that have special meaning in the binding path, including full stop ('.'), Slash ('/'), square brackets ('[', ']') and brackets ('(', ')' ), brackets will cause the application to crash. These special characters can be escaped by the surrounding anchor path with square brackets. More information about paths and character escaping can be found in [Binding Declaration Overview] [2]
This related question also contains a good solution for working with meshes that want to use automatically generated columns.
Use the AutoGeneratingColumn event and manually create bindings for columns with these special characters in their name to avoid them using square brackets.
<DataGrid x:Name="dgLFKPI" AutoGeneratingColumn="dgLFKPI_AutoGeneratingColumn" />
private void dgLFKPI_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e) { if (e.PropertyName.Contains('/') && e.Column is DataGridBoundColumn) { var col = e.Column as DataGridBoundColumn; col.Binding = new Binding(string.Format("[{0}]", e.PropertyName)); } }
source share