How can I determine the primitive Type of the bound column to a DataGrid control, when the control is created using AutoGeneratingColumn?
I have looked in all these classes: DataGridColumn, DataGridBoundColumn, DataGridTextColumn, and DataGridBoundColumn.Binding.
I am unable to determine which Type (primitive type) the columns are bound to. (They are Bound to a SQL table.) I want to apply different styles and converters based on the type. I could Hard Code these styles and converters based on the column name (which I can get from DataGridTextColumn.Header), but I want to AVOID THAT AT ALL COSTS!
Looks like I found the answer.
The type is passed into the “AutoGeneratingColumn” handler as e.PropertyType.
The problem is, it isn’t the real type. It must be boxed, because even though the database column is “nullable” the type passed isn’t.
So, I am going to have to “Hard Code” my solution, based on Column Name. 🙁