Reputation: 31743
I created a UserControl with a Button, a TextBox and a DataGridView. I set the modifiers of all controls to public.
Now If I inherit from that UserControl, I can modify the TextBox and the Button via Designer (move around, change properties) just as I expected. But for the DataGridView all properties are disabled.
Is there any reason, why I can't modify a DataGridView via the Designer in an inherited UserControl?
Upvotes: 3
Views: 4822
Reputation: 31743
Found a solution here: http://adamhouldsworth.blogspot.com/2010/02/winforms-visual-inheritance-limitations.html
In short:
Inherit from DataGridView with this code:
[Designer(typeof(ControlDesigner))]
public class InheritableDataGridView : DataGridView
{
public InheritableDataGridView()
: base()
{ }
}
Upvotes: 4