Reputation: 2557
I have a datagridview configured to autogenerate columns based on my class (using databinding).
It works just fine for all my properties of type string
. However, I have a property of an enum type, with a typeconverter to convert it to an image.
I'd like for my Grid's autogeneration of columns to produce a DataGridViewImageColumn
instead of a DataGridViewTextBoxColumn
.
The only DGV method that seems helpful is columns added. However, you cannot set the column there, only get & modify.
Any Ideas?
Upvotes: 4
Views: 995
Reputation: 401
as far as i know, the AutoGeneration isn't very configurable
but you can make an alternative auto gen for yourself:
set autogen = false,
register to these events:
add a single function that will be triggered for both, which will create columns for the dataSource given:
Upvotes: 2