I have a UserControl with some predefined controls (groupbox,button,datagridview) on it, these controls are marked as protected and the components variable is also marked as protected.
I then want to inherit from this base UserControl to another UserControl, however the DataGridView is always locked in the designer.
I suspect it may have something to do with the DataGridView implementing ISupportInitilize.
public class BaseGridDetail : UserControl
Has a DataGridView control (et al) defined.
public class InheritedDetail : BaseGridDetail
The DataGridView control is locked
Does anyone have any ideas how to make this control available in the designer after inheritenace?
By the looks of it, DataListView (and some other controls) do not support visual inheritance. There’s a connect issue logged here which doesn’t look hopeful.
There have been similar issues logged with other form controls, e.g. flowlayoutpanel.
I’m unable to find a way to force visual inheritance.
Here’s the official answer on connect: ‘For this particular release, the DataGridView was not designed to be used in visual intheritance. We will keep your suggestion in mind when we plan our future release’ That is of 26/05/2006.
Update: found this blog post which may have the answer
Edit: I was unable to verify the blog post’s claims. Looks like might be the latest on this issue
It looks like you can still manipulate the DataListView at runtime though, so you might be able to set visual properties (and other settings). It’s not a great compromise.