WPF Datagrid binding errors with dots in column headers

前端 未结 2 1001
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-17 06:21

I have a .Net datatable that I am using as a source to a WPF datagrid. The problem I have is that some of the column headers in the datatable contain dots. When binding the

2条回答
  •  醉酒成梦
    2020-12-17 06:42

    As you've discovered, dot notation for anything other than Binding is problematic with WPF. What I'd recommend is to revise your headers to alias the column names with dot notation:

    Col.A should be Col_A
    Col.B should be Col_B
    etc...
    

    If the headers are coming from a direct SQL query, alias the sql column names in the same manner.

    Going down the path of using the dot notation will just continue leading into one hackish fix to resolve the previous 'fix'. All of this can be easily resolved by just revising your naming conventions.

提交回复
热议问题