Category / Section
How to avoid rangestyles or other collections being written out as code in a derived WinForms Gridcontrol?
1 min read
Serialization
When a derived grid is dropped onto a form at the design-time, the styles that are changed in the derived grid's constructor are written as code in the form. You can avoid this serialization to code by overriding the respective properties and by setting it to the DesignerSerializationVisibility.Hidden.
As an example, the SerializeCellsBehavior being serialized to code can be avoided by overriding the SerializeCellsBehavior and setting it to the DesignerSerializationVisibility.Hidden.
C#
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public new Syncfusion.Windows.Forms.Grid.GridSerializeCellsBehavior SerializeCellsBehavior { get { return base.SerializeCellsBehavior; } set { base.SerializeCellsBehavior = value; } }
VB
<Browsable(False), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> Public Shadows Property SerializeCellsBehavior() As Syncfusion.Windows.Forms.Grid.GridSerializeCellsBehavior Get Return MyBase.SerializeCellsBehavior End Get Set(ByVal value As Syncfusion.Windows.Forms.Grid.GridSerializeCellsBehavior) MyBase.SerializeCellsBehavior = value End Set End Property