I'm working on creating a custom winforms datagridview control that inherits the built in DataGridView control. I'm having an issue with the Columns property, the property is set to as ReadOnly so I can't edit any information in it and need to add columns to the datagrid. If you look at the property outside of my custom control you have the options to add a column or edit a column, once I'm in my custom control that Add and Edit are no longer available. I'm not sure how to get these options to show up in my custom control as I don't want to have to create all of my columns in code because that's UI code and should exist in the .designer class and not in the .resx class.
I'm sure there is a way to do this, but it's just not coming to me. Hopefully someone out there can point me in the write direction.
Best Answer
If you are creating a
UserControl
that contains aDataGridView
then you must expose aColumns
property for the user-control. Typically, you create the property that wraps the grid's Columns property. Very common.