Members  Example 

GridStyleInfo Class

Implements the functionalities that holds all information stored for a cell.
Object Model
GridStyleInfo ClassGridMarginsInfo ClassGridBordersInfo ClassGridStyleInfoIdentity ClassGridCellModelBase ClassGridCheckBoxCellInfo ClassGridCommentTipInfo ClassGridCurrencyEditInfo ClassGridStyleInfoCustomPropertiesCollection ClassGridStyleInfo ClassGridFontInfo ClassGridFormulaTag ClassStyleInfoIdentityBase ClassBrushInfo ClassGridMaskEditInfo ClassGridNumericUpDownCellInfo ClassGridProgressBarInfo ClassGridCellUIAProvider ClassGridMarginsInfo ClassGridBordersInfo ClassGridCheckBoxCellInfo ClassGridFontInfo ClassGridNumericUpDownCellInfo ClassGridMarginsInfo ClassGridCellValidateValueInfo ClassGridStyleInfoStore ClassGridMarginsInfo ClassGridCellValidateValueInfo Class
Public Class GridStyleInfo 
   Inherits Syncfusion.Styles.StyleInfoBase
   Implements Syncfusion.Styles.IStyleInfo 
Dim instance As GridStyleInfo
public class GridStyleInfo : Syncfusion.Styles.StyleInfoBase, Syncfusion.Styles.IStyleInfo  
GridStyleInfo provides user-friendly access to all properties stored in GridStyleInfoStore. It also has Identity information and can inherit properties from base styles (row styles, column styles, table style).

GridModel provides a very simple way to query and change cell contents using the indexer.

A cell's behavior and appearance can be customized with the following properties of the GridStyleInfo class:

PropertyName Description
AllowEnter (System.Boolean) Gets / sets if pressing the <Enter>-Key should insert a new line into the edited text. (Default: False)
AutoSize (System.Boolean) Gets / sets if the cell height should automatically increase when the edited text does not fit into the cell and WrapText is True. If WrapText is False, AutoSize will affect the column width. (Default: False)
BackgroundImage (System.Drawing.Image) Gets / sets the image that the cell displays as background. (Default: NULL)
BackgroundImageMode (GridBackgroundImageMode) Indicates how the background image is displayed. (Default: GridBackgroundImageMode)
BaseStyle (System.String) The base style for this style instance with default values for properties that are not initialized for this style object. (Default: String.Empty)
Borders (GridBordersInfo) Top, left, bottom, and right border settings. (Default: GridBordersInfo.Default)
CellAppearance (GridCellAppearance) Specifies if cell edges shall be drawn raised, sunken, or flat (default). (Default: GridCellAppearance.Flat)
CellTipText (System.String) ToolTip text to be displayed when user hovers mouse over cell. (Default: String.Empty)
CellType (System.String) The cell type for this style instance. Cell types are accessed in the grid through the GridModel.CellModels property of a GridModel which returns a GridCellModelBase object. To access cell renderers, use the GridControlBase.CellRenderers property of a GridControlBase instance. (Default: Text Box)
CellValue (System.Object) This property holds the cell value. Although the cell value is typically a string, it can also be any other primitive type such as int, byte, enum, or any custom type that is derived from System.Object. (Default: String.Empty)
CellValueType (System.Type) Specifies the preferred System.Type for cell values. When you assign a value to the GridStyleInfo object, the value will be converted to this type. If the value cannot be converted, Error will contain error information. (Default: NULL)
CharacterCasing (System.Windows.Forms.CharacterCasing) Specifies if cell control modifies the case of characters as they are typed when the cell's CellType is "OriginalTextBox". (Default: CharacterCasing.Normal)
CheckBoxOptions (GridCheckBoxCellInfo) Gets / sets flat look and values that represent checked, unchecked, and indeterminate state of the check box. (Default: NULL)
ChoiceList (System.Collections.Specialized.StringCollection) Specifies items to be displayed in a drop-down list. (Default: NULL)
Clickable (System.Boolean) Specifies if the user can click on any cell button elements in this renderer. (Default: true)
Control (System.Windows.Forms.Control) A custom control you can associate with a cell. (Default: null)
CultureInfo (System.Globalization.CultureInfo) The culture information holds rules for parsing and formatting the cells value. (Default: null)
CurrencyEdit (GridCurrencyEditInfo) A nested object with currency text box properties for a cell. (Default: GridCurrencyEditInfo.Default)
DataSource (System.Object) Specifies a data source that holds items to be displayed in a drop-down list. A data source can be specified instead of manually filling the choicelist with string entries. (Default: NULL)
Description (System.String) Gets / sets the text that is shown in check box or pushbuttons. (Default: String.Empty)
DisplayMember (System.String) Names the property in the DataSource that holds the text to be displayed in a cell that depends on a ValueMember. (Default: String.Empty)
DropDownStyle (GridDropDownStyle) Specifies if user input is restricted to items from the ChoiceList or DataSource. (Default: GridDropDownStyle.Editable)
Enabled (System.Boolean) Specifies if the cell can be activated as current cell or if the cell should be skipped when moving the current cell. (Default: True)
Error (System.String) Holds error information if a value could not be converted to the System.Type specified with CellValueType. (Default: String.Empty)
ExclusiveChoiceList (System.Boolean) Specifies if user input is restricted to items from the ChoiceList or DataSource. (Default: False)
FloatCell (System.Boolean) Gets / sets if text can float into the boundaries of a neighboring cell. (Default: True)
FloodCell (System.Boolean) Gets / sets if this cell can be flooded by a previous cell. (Default: True)
Font (GridFontInfo) The font for drawing text. (Default: GridFontInfo.Default)
Format (System.String) Gets / sets the format mask for formatting the cell value. You can specify numeric format strings, date format strings, or enumeration format strings as discussed in the section "Format Specifiers and Format Providers" of the .NET Framework Developers Guide (see ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconformatspecifiersformatproviders.htm) (Default: String.Empty)
FormulaTag (GridFormulaTag) A formula tag that is associated with a cell. (Default: NULL)
HorizontalAlignment (GridHorizontalAlignment) Specifies horizontal alignment of text in the cell. (Default: GridHorizontalAlignment.Left)
HotkeyPrefix (System.Drawing.Text.HotkeyPrefix) Specifies how hot-key prefixes should be displayed. Hot-keys are indicated in text with an '&' (ampersand). When you enable hot-key prefix, the specific characters can be displayed underlined or regular. The '&' will not be displayed. (Default: HotkeyPrefix.Show)
ImageIndex (System.Int32) Specifies an index for an image in the ImageList of a GridStyleInfo instance. (Default: -1)
ImageList (System.Windows.Forms.ImageList) The ImageList that holds a collection of images. Cells can choose images with the ImageIndex property in a GridStyleInfo instance. (Default: NULL)
Interior (Syncfusion.Drawing.BrushInfo) Lets you specify a solid back color, gradient, or pattern style with both back and fore color for a cell's background. (Default: SystemColors.Window)
MaskEdit (GridMaskEditInfo) A nested object with masked edit properties for a cell. (Default: GridMaskEditInfo.Default)
MaxLength (System.Int32) Limits the number of characters the user can type into the cell. Note: When selecting text from a choice list or when pasting text, the text can be longer. Additional validation is necessary on your side. (Default: 0)
MergeCell (GridMergeCellDirection) Specifies merge behavior for an individual cell when merging cells feature has been enabled in a GridModel with MergeCellsMode. (Default: GridMergeCellDirection.None)
NumericUpDown (GridNumericUpDownCellInfo) NumericUpDown lets you specify the step, minimum, and maximum value and if the value should start over when you reach the maximum value. (Default: NULL)
PasswordChar (System.Char) The character used to mask characters of a password in a password-entry cell. The cell's CellType must be "OriginalTextBox". (Default: Blank)
ProgressBar (GridProgressBarInfo) A nested object with ProgressBar properties for a cell. Default: GridProgressBarInfo.Default)
ReadOnly (System.Boolean) Specifies if cell contents can be modified by the user. You can programatically change Read-only cells by setting GridModel.DiscardReadOnly to True. (Default: False)
ShowButtons (GridShowButtons) Specifies when to show or display the cell buttons. Possible choices are: show the button only for the current cell, always show buttons, or never show buttons. (Default: GridShowButtons.Show)
StrictValueType (System.Boolean) Indicates whether an exception should be thrown in the ApplyFormattedText(String) method if the formatted text can not be parsed and converted to the type specified with CellValueType. (Default: True)
Tag (System.Object) A custom tag you can associate with a cell. (Default: NULL)
Text (System.String) Gets / sets the value as a string. If a CellValueType is specified, the text will be parsed and converted to the type specified with CellValueType using any CultureInfo information. (Default: String.Empty)
TextAlign (GridTextAlign) Align text left of button elements (which is typical for combo boxes). Or align text right of button elements. (Default: GridTextAlign.Default)
TextColor (System.Drawing.Color) Lets you specify the color for drawing the cell text. (Default: SystemColors.WindowText)
TextMargins (GridMarginsInfo) Holds text margins in pixels. When drawing a cell, this specifies the empty area between the text rectangle and the client rectangle of the cell without borders and cell buttons. (Default: GridMarginsInfo.Default)
Themed (System.Boolean) Specifies if cell should be drawn using Windows XP themes when GridControlBase.ThemesEnabled has been set. (Default: True)
TriState (System.Boolean) Specifies if this is a Tristate check box that has an additional indeterminate state. (Default: False)
Trimming (System.Drawing.StringTrimming) Indicates how text is trimmed when it exceeds the edges of the cell text rectangle. (Default: StringTrimming.Character)
ValidateValue (GridCellValidateValueInfo) Holds validation rules for the cell value that are being checked before any user changes are committed to the grid cells style object. (Default: NULL)
ValueMember (System.String) Gets / sets a string that specifies the property of the data source from which to draw the value. (Default: String.Empty)
VerticalAlignment (GridVerticalAlignment) Specifies vertical alignment of text in the cell. (Default: GridVerticalAlignment.Top)
VerticalScrollbar (System.Boolean) Specifies if text box should show a vertical scrollbar when text is being edited and does not fit in cell. WrapText must be initialized to True. (Default: False)
WrapText (System.Boolean) Specifies if text should be wrapped when it does not fit into a single line. (Default: True)

The following example makes some changes to the grid using the indexer: If you query for specific attributes in a cell and these attributes have not been explicitly set for the cell, the GridStyleInfo object that is return by the indexer is smart enough to query base styles for queried information.
model[2, 2].Text = "Grid Demo";
model[2, 2].Font.Bold = True;
model[2, 2].Font.Size = 16;
model[2, 2].HorizontalAlignment = GridHorizontalAlignment.Center;
model[2, 2].VerticalAlignment = GridVerticalAlignment.Middle;
model[2, 2].CellType = "Static";
model[2, 2].Borders.All = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(100, 238, 122, 3));
model[2, 2].Interior = new BrushInfo(GradientStyle.PathEllipse, Color.FromArgb(100, 57, 73, 122), Color.FromArgb(237, 240, 247));
GridStyleInfo standard = model.BaseStylesMap["Standard"].StyleInfo;
standard.TextColor = Color.FromArgb(0, 21, 84);
    Color color = model[1, 1].TextColor;
    // model[1, 1].TextColor will return Color.FromArgb(0, 21, 84));
Inheritance Hierarchy

Syncfusion.Grid.Windows: 18.2460.0.44

See Also