Question

I have a SQL CE database, which is beyond my control, that has fields in the format of ., complete with a period in the column name. The columns will always be different, so I cannot have a strong-typed data field. I've been tasked with displaying dynamic table data into a DataGrid.

Normally, this would be easy -- auto-generate the columns and everything is cool. Easy example.

However, I'm not allowed to do this, since the '.' character in the column names nukes the binding.

Right now, I'm trying to add a layer of translation to the dataset (probably will have to maintain a dictionary with translations of . to _).

My question is -- is there a better way? I recall something a while back about being able to have a SourceColumnName in a DataTable, but I didn't see it. There's a "Caption," but I cannot bind to that...

Any thoughts?

Was it helpful?

Solution

For alternative replace . dot with \u2024

If you put this question to Microsoft people, they will tell you that this (your problem) is because WPF DataGrid supports "sub properties data mapping" when there is a data source. For this reason, . dot tries to resolve to sub object contained in your DataTable.

In the next line they will politely ask you to replace your . dot to _ Underscore in column name.

(http://social.msdn.microsoft.com/Forums/en/wpf/thread/7d84c8f2-2709-4642-a259-739036ffd2a6)

But that's neither a solution nor an alternative.

Solution will only be provided by them by changing their coding.

For alternative replace . with \u2024 This is the unicode character for C/C++/Java

More on this here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top