7 Answers, 1 is accepted
Is it possible to set a custom attribute on my data, and read that same attribute from the DataType property in my OnAutoGeneratingColumn event handler?
My initial tests show that the name and type are correct, but I see no attributes that I had added.
How have you set a custom attribute? Basically, RadGridView respects Data Annotations and you can try this. You can check the following msdn article:
Using Data Annotations to Customize Data Classes.
First off, I apologize, this was meant for the WPF forum, but I posted too quickly. Please move it if you need to.
I am using some of the DataAnnotations attributes, and they work wonderfully. My hope was to set which properties would aggregate with a format string with a custom attribute. Something like below.
I actually got this working after posting, but it is a bit of a workaround. In the AutoGeneratingColumn event, I match the column name against the RadGridView item and pull the attributes from there, not the column.datatype. But if there is a more elegant solution, I wouldn't mind changing my existing work.
As it turns out there is not a more elegant way to propose.