views:

182

answers:

0

I am creating a custom control, constisting of DataGridView, a few additional buttons and useful functions.

For user of the control to be able editing grid's columns I added Columns property of type DataGridViewColumnCollection.

Now it's possible to edit columns through Property Editor (clicking by a small button near Columns property), but there are a couple of problems. If I press Add button in Columns Editor to add a new column, I don't get a standard dialog with choosing column type, a column is added immediately without asking me its type and its type is left as base type - DataGridViewColumn. Additionally it results in that when adding a column to the the grid in the designer serialized code (grid.Columns.AddRange()) I get an exception that column doesn't have CellType specified.

Also I can't just edit properties of default grid columns (specified by my custom control), because these changes are not serialized. DesignerSerializationVisibility is set to DesignerSerializationVisibility.Content.

What am I doing wrong and how to do it correctly?

I know the question is not simple, but please try to help me..

Thank you in advance.