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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Inheriting from Grid Control

Thread ID:

Created:

Updated:

Platform:

Replies:

7509 Sep 29,2003 12:58 PM UTC Sep 29,2003 06:25 PM UTC WinForms 1
loading
Tags: GridControl
Trevor Moody
Asked On September 29, 2003 12:58 PM UTC

What is the recomended way of creating a Base Grid which has a series of BaseStyles, Context menu's, etc already defined. do we just inherit a base class from the Syncfusion gridControl and define all of these things there? I have tried this already, and when i add a derived grid to a form, it copies any styles that i have in my base class into the initialise component of the form, however, if i subsequently add a style to the base class, the derived class will not automatically pick up the new style. Thanks Trevor Trev

Administrator [Syncfusion]
Replied On September 29, 2003 06:25 PM UTC

Hi Trev, Call InitBaseStyles(); from your derived grid ctor. That InitBaseStyles method could look as follows: internal void InitBaseStyles() { if (!BaseStylesMap.Modified) { GridStyleInfo style = BaseStylesMap["Row Header"].StyleInfo; style = BaseStylesMap["Standard"].StyleInfo; style.CheckBoxOptions.CheckedValue = "True"; style.CheckBoxOptions.UncheckedValue = "False"; style.Font.Facename = "Tahoma"; style.Font.Size = 8; style.WrapText = true; style.AllowEnter = false; style = BaseStylesMap["Row Header"].StyleInfo; style.CellType = "RowHeaderCell"; style.Enabled = false; style = BaseStylesMap["Column Header"].StyleInfo; style.Enabled = false; style.CellType = "ColumnHeaderCell"; style.Font.Bold = false; style = BaseStylesMap["Summary"].StyleInfo; //style.Font.Bold = false; style.BackColor = SystemColors.Info; style.TextColor = SystemColors.InfoText; style.Enabled = false; style.CellType = "Static"; style.Borders.Right = GridBorder.Empty; style.Borders.Top = new GridBorder(GridBorderStyle.Solid, Color.Blue, GridBorderWeight.Medium); ... BaseStylesMap.Modified = false; } } The key point is that you have to set BaseStylesMap.Modified = false; That way the designer will know the base styles have not been touched by the user. Another key point is that you check for BaseStylesMap.Modified at the beginning of InitBaseStyles. That is important if you deserialize your grid document using runtime serialization from a file or binary stream because in that case you do not want override the settings that were loaded from the SerializationInfo document. Stefan

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;