We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Inherit from GridControl

Hei,

I want to make a derived control that inherits from your GridControl. The purpose is to make a base control with certain settings (like grid style, selection mode, hiden row headers, etc) to use in our project.

When I make my custom control and use it in a form, I get the problem with all the base styles being re-generated by the designer in InitializeComponent(). I have made changes to the base styles in my custom derived grid. I know one solution is to override the property and set the DesignerSerializationVisibility attribute to Hidden. But what if I want the user to be able to change this property? Ideally the code should only be re-generated by the designer if it changes from the custom control.

For simple properties I can override them in my control class and set the DefaultValue attribute to what I want to be default.

Do you have any ideas or tips with this issue?

Regards
Kjetil

1 Reply

HA haneefm Syncfusion Team August 3, 2007 03:30 PM UTC

Hi Kjetil,

In your Gridcontrol-derived class try to override these methods using the new keyword and specify DesignerSerializationVisibility.Hidden:

[C#.Net]
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new GridRangeStyleCollection RangeStyles
{
get
{
return base.RangeStyles;
}
set
{
base.RangeStyles = value;
}
}


[VB.Net]

Public Shadows Property RangeStyles() As GridRangeStyleCollection
Get
Return MyBase.RangeStyles
End Get
Set
MyBase.RangeStyles = Value
End Set
End Property

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon