Class GridEngine
The engine lets you set the main datasource for the whole engine. The TableDescriptor will pick up the ItemProperties (schema information) from the datasource and the table will be initialized at run-time with records from the list.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid.Grouping
Assembly: Syncfusion.Grid.Grouping.Windows.dll
Syntax
public class GridEngine : GridEngineBase, ICustomTypeDescriptor, ITableEventsTarget, IComponent, IDisposable, IGridTableCellAppearanceSource, IGridGroupOptionsSource, IGridTableOptionsSource, ISupportInitialize
Remarks
The TableDescriptor is browsable. You can modify its collections and properties in the designer.
By default, TableDescriptor is auto-populated. If you do not modify its settings and later change the datasource, it will be automatically reinitialized. If you have made modifications to the TableDescriptor and changed the SourceList, the modifications will be kept. To discard modifications of a TableDescriptor, you need to explicitly call ResetTableDescriptor.
The Table is dependent on information provided by the TableDescriptor and the records from SourceList. It is created on the fly and can not be designed with designer.
The GridEngine class adds the plumbing for displaying the data in a GridGroupingControl. You can specify the datasource using the DataSource and DataMember properties through the designer.
Constructors
GridEngine()
Initializes a new instance of the GridEngine .
Declaration
public GridEngine()
Fields
BlinkIncreased
Default value for BlinkIncreased state.
Declaration
public static readonly string BlinkIncreased
Field Value
| Type |
|---|
| System.String |
BlinkNewRecord
Default value for BlinkNewRecord state.
Declaration
public static readonly string BlinkNewRecord
Field Value
| Type |
|---|
| System.String |
BlinkNewValue
Default value for BlinkNewValue state.
Declaration
public static readonly string BlinkNewValue
Field Value
| Type |
|---|
| System.String |
BlinkNullValue
Default value for BlinkNullValue state.
Declaration
public static readonly string BlinkNullValue
Field Value
| Type |
|---|
| System.String |
BlinkReduced
Default value for BlinkReduced state.
Declaration
public static readonly string BlinkReduced
Field Value
| Type |
|---|
| System.String |
Properties
AllowCacheStyles
Gets or sets the value that whether indicating the flag is enable if you want GridRecordRow and GridCaptionRow elements to keep a cache with style information for individual cells and reduce the number of QueryCellStyleInfo calls being raised for this cell.
Declaration
public bool AllowCacheStyles { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Remarks
When you enable this property, the CreateRecordRow(RecordRowsPart) and CreateCaptionRow(CaptionSection) methods will instantiate derived GridRecordRowWithCache and GridCaptionRowWithCache elements that implement the IGridTableCellStyleCache interface.
If other elements should support caching, you can add support for caching by deriving a class from the elements base class and implement the IGridTableCellStyleCache interface. See the GridRecordRowWithCache implementation how to do this.
Appearance
Gets or sets the default GridTableCellAppearance with default GridTableCellStyleInfo information for all cell elements in the control. This property lets you control almost any aspect of the appearance of the grouping grid like cell background color, font, or the cell type.
Declaration
public GridTableCellAppearance Appearance { get; set; }
Property Value
| Type |
|---|
| GridTableCellAppearance |
AppearanceVersion
Gets or sets the version of the Appearance object. This number is increased each time a property in the Appearance object is changed.
Declaration
public int AppearanceVersion { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
BaseStyles
Maintains a collection of base styles. Users can add BaseStyles to the engine (also in design-time) and then inherit style settings through the GridStyleInfo.BaseStyle property in GridTableCellStyleInfo property of GridTableCellAppearance.
Declaration
public GridTableBaseStyleCollection BaseStyles { get; set; }
Property Value
| Type |
|---|
| GridTableBaseStyleCollection |
BlinkTime
Gets or sets the time in milliseconds how long to highlight values in a record after a change was detected. The engine will highlight a cell for the specified period in milliseconds if the value was increased or decreased. If set to 0 the feature is disabled.
Declaration
public int BlinkTime { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
ChildGroupOptions
Lets you control the look of inner groups like whether the Caption Row is visible, or what CaptionText is.
Declaration
public GridGroupOptionsStyleInfo ChildGroupOptions { get; set; }
Property Value
| Type |
|---|
| GridGroupOptionsStyleInfo |
DefaultAppearance
Gets default appearance settings for the grid at runtime. These settings will not be serialized or written to good and can be used if you want to specify default settings for a derived GridGroupingControl. Any appearance element in the engine will inherit these settings.
Declaration
public GridTableCellAppearance DefaultAppearance { get; }
Property Value
| Type |
|---|
| GridTableCellAppearance |
DefaultBaseStyles
Maintains a collection of default base styles which are not serialized to xml or code. End users can override the base styles by manually adding a base style with the same name to the BaseStyles collection.
Declaration
public GridTableBaseStyleCollection DefaultBaseStyles { get; }
Property Value
| Type |
|---|
| GridTableBaseStyleCollection |
GroupDropArea
Used internally. Gets or sets the value that indicating whether the visibility of GroupDropArea from ParentControl.
Declaration
public bool GroupDropArea { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
GroupingControl
Gets the GridGroupingControl that hosts this engine.
Declaration
public GridGroupingControl GroupingControl { get; }
Property Value
| Type |
|---|
| GridGroupingControl |
Initializing
Gets the value that Determines if BeginInit() was called.
Declaration
public bool Initializing { get; }
Property Value
| Type |
|---|
| System.Boolean |
InsertRemoveBehavior
Gets or sets it's specifies how the grid should react if records are inserted or deleted.
Declaration
public GridListChangedInsertRemoveBehavior InsertRemoveBehavior { get; set; }
Property Value
| Type |
|---|
| GridListChangedInsertRemoveBehavior |
InsertRemoveBehaviorWithEndEdit
Gets or sets specifies how the grid should react if records are inserted or deleted through direct user interaction with AddNew record.
Declaration
public GridListChangedInsertRemoveBehavior InsertRemoveBehaviorWithEndEdit { get; set; }
Property Value
| Type |
|---|
| GridListChangedInsertRemoveBehavior |
InvalidateAllWhenListChanged
Gets or sets the value that indicating whether the grid should simply call Invalidate when a ListChanged event is handled or if it should determine the area that is affected by the change and call InvalidateRange. With version 4.4 check also the InsertRemoveBehavior and SortPositionChangedBehavior properties.
Declaration
public bool InvalidateAllWhenListChanged { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Remarks
On first sight, you might think it better to determine the area that is affected by a change and call InvalidateRange. But when calling InvalidateRange, the grid needs to know the exact position of the record in the table before it can mark that area dirty. In order to determine the record position (and y-position of the row in the display), counters need to be evaluated. This operation can cost more time than simply calling Invalidate in high-frequency update scenarios.
Also, be aware that the group caption bar needs to be updated when a record changes.
With version 4.4 check out the new InsertRemoveBehavior and SortPositionChangedBehavior properties and the UpdateDisplayFrequency properties that will speed up things a lot if InvalidateAllWhenListChanged = false.
NestedTableGroupOptions
Gets or sets the style info for the child group option. Lets you control the look of the topmost group of nested tables such as whether the Caption Row is visible or what CaptionText is.
Declaration
public GridGroupOptionsStyleInfo NestedTableGroupOptions { get; set; }
Property Value
| Type |
|---|
| GridGroupOptionsStyleInfo |
ParentControl
Gets the GridGroupingControl that hosts this engine.
Declaration
public GridGroupingControl ParentControl { get; }
Property Value
| Type |
|---|
| GridGroupingControl |
PropertyTypeDefaultStyles
A collection of GridPropertyTypeDefaultStyle with default GridTableCellStyleInfo information for RecordFieldCell elements based on the columns System.Type. Each basic type has default style information registered with this collection.
Declaration
public GridPropertyTypeDefaultStyleCollection PropertyTypeDefaultStyles { get; }
Property Value
| Type |
|---|
| GridPropertyTypeDefaultStyleCollection |
Remarks
The collection contains pre-defined settings such as HorizontalAlignment for numbers and cell type (e.g. check box for boolean).
GridPropertyTypeDefaultStyle settings have less precedence in styles inheritance than Appearance styles.
Note: Changes you make to this collection do not get serialized; you will need to reapply any changes even if you read back the schema from an XML file.
SortPositionChangedBehavior
Gets or sets it's specifies how the grid should react if the sort position of a record records changes.
Declaration
public GridListChangedInsertRemoveBehavior SortPositionChangedBehavior { get; set; }
Property Value
| Type |
|---|
| GridListChangedInsertRemoveBehavior |
SortPositionChangedBehaviorWithEndEdit
Gets or sets specifies how the grid should react if the sort position of a record records changes when the current record is edited interactively by user.
Declaration
public GridListChangedInsertRemoveBehavior SortPositionChangedBehaviorWithEndEdit { get; set; }
Property Value
| Type |
|---|
| GridListChangedInsertRemoveBehavior |
Table
Gets the table object manages the records from the engine's DataSource and provides access to records and grouped elements through several collection classes, most prominent the DisplayElementsInTableCollection.
Declaration
public GridTable Table { get; }
Property Value
| Type |
|---|
| GridTable |
TableControl
Gets the main GridTableControl. The GridTableControl is a grid derived from GridControlBase and displays and allows user interaction and modification of data.
Declaration
public GridTableControl TableControl { get; }
Property Value
| Type |
|---|
| GridTableControl |
Remarks
This control is either a child control of the GridTablePanel or RecordNavigationControl depending on whether the ShowNavigationBar is set.
TableDescriptor
Gets or sets the table schema information of the root table in the data source.
Declaration
public GridTableDescriptor TableDescriptor { get; set; }
Property Value
| Type |
|---|
| GridTableDescriptor |
TableModel
Gets the GridTableModel of the TableControl. The GridTableModel is derived from the GridModel and adds support for retrieving data from the data source for a GridTableControl.
Declaration
public GridTableModel TableModel { get; }
Property Value
| Type |
|---|
| GridTableModel |
TableOptions
Gets or sets the style info for the table options. Lets you set table-wide properties like the width of the indent column, or whether header rows should be visible.
Declaration
public GridTableOptionsStyleInfo TableOptions { get; set; }
Property Value
| Type |
|---|
| GridTableOptionsStyleInfo |
TopLevelGroupOptions
Gets or sets the style info of the Group option. Lets you control the look of the top most group such as whether the Caption Row is visible, or what CaptionText is.
Declaration
public GridGroupOptionsStyleInfo TopLevelGroupOptions { get; set; }
Property Value
| Type |
|---|
| GridGroupOptionsStyleInfo |
UpdateDisplayFrequency
Gets or sets specifies the number of milliseconds to wait between display updates when new ListChanged event handler logic is used. This property does have no any effect if UseOldListChangedHandler = true. Special values are 0 - only manually update display by calling grid.Update() and 1 - update display immediately after each change.
Declaration
public int UpdateDisplayFrequency { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
UseDefaultsForFasterDrawing
Gets or sets the value that indicating whether initializing is recommended settings to improve handling of ListChanged events and scrolling through grid. Affected settings are: ColumnsMaxLengthStrategy, GridLineBorder, DrawTextWithGdiInterop, VerticalPixelScroll, WrapText and Trimming.
Declaration
public bool UseDefaultsForFasterDrawing { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
VersionInfo
Gets the assembly version of the GridGroupingControl at the time it was dropped onto a form with designer.
Declaration
public override string VersionInfo { get; }
Property Value
| Type |
|---|
| System.String |
Overrides
Methods
AddBaseStylesForBlinking()
Adds base styles that to the BaseStyles collection that allow customization of appearance of blinking cells.
Declaration
public void AddBaseStylesForBlinking()
BeginInit()
Implements System.ComponentModel.ISupportInitialize.BeginInit of the System.ComponentModel.ISupportInitialize interface.
Declaration
public void BeginInit()
CreateAddNewRecord(AddNewRecordSection)
Creates an AddNewRecord for the given parent.
Declaration
public override AddNewRecord CreateAddNewRecord(AddNewRecordSection parent)
Parameters
| Type | Name | Description |
|---|---|---|
| AddNewRecordSection | parent | Parent section. |
Returns
| Type | Description |
|---|---|
| AddNewRecord | The new add new record. |
Overrides
CreateAddNewRecordSection(Group)
Creates an AddNewRecordSection for the given parent.
Declaration
public override AddNewRecordSection CreateAddNewRecordSection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | Parent group. |
Returns
| Type | Description |
|---|---|
| AddNewRecordSection | The new add new record section. |
Overrides
CreateCaptionRow(CaptionSection)
Creates a CaptionRow for the given element.
Declaration
public override CaptionRow CreateCaptionRow(CaptionSection parent)
Parameters
| Type | Name | Description |
|---|---|---|
| CaptionSection | parent | Parent caption section. |
Returns
| Type | Description |
|---|---|
| CaptionRow | The new caption row. |
Overrides
CreateCaptionSection(Group)
Creates a CaptionSection for the given element.
Declaration
public override CaptionSection CreateCaptionSection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | Parent group. |
Returns
| Type | Description |
|---|---|
| CaptionSection | The new caption section. |
Overrides
CreateChildTable(Element)
Creates a ChildTable.
Declaration
public override ChildTable CreateChildTable(Element parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Element | parent | The parent element. |
Returns
| Type | Description |
|---|---|
| ChildTable | The new child table. |
Overrides
CreateColumnHeaderRow(ColumnHeaderSection)
Creates a ColumnHeaderRow.
Declaration
public override ColumnHeaderRow CreateColumnHeaderRow(ColumnHeaderSection parent)
Parameters
| Type | Name | Description |
|---|---|---|
| ColumnHeaderSection | parent | The parent section. |
Returns
| Type | Description |
|---|---|
| ColumnHeaderRow | The new column header row. |
Overrides
CreateColumnHeaderSection(Group)
Creates a ColumnHeaderSection.
Declaration
public override ColumnHeaderSection CreateColumnHeaderSection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| ColumnHeaderSection | The new column header section. |
Overrides
CreateEmptySection(Group)
Creates an EmptySection.
Declaration
public override EmptySection CreateEmptySection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| EmptySection | The new empty section. |
Overrides
CreateFilterBarRow(FilterBarSection)
Creates a FilterBarRow.
Declaration
public override FilterBarRow CreateFilterBarRow(FilterBarSection parent)
Parameters
| Type | Name | Description |
|---|---|---|
| FilterBarSection | parent | The parent section. |
Returns
| Type | Description |
|---|---|
| FilterBarRow | The new filter bar row. |
Overrides
CreateFilterBarSection(Group)
Creates a FilterBarSection.
Declaration
public override FilterBarSection CreateFilterBarSection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| FilterBarSection | The new filter bar section. |
Overrides
CreateFromXml(TextReader)
Creates a GridEngine object from a valid XML stream.
Declaration
public GridEngine CreateFromXml(TextReader r)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.TextReader | r | The TextReader with XML stream. |
Returns
| Type | Description |
|---|---|
| GridEngine | A GridEngine object. |
CreateFromXml(XmlReader)
Creates a GridEngine object from a valid XML stream.
Declaration
public virtual GridEngine CreateFromXml(XmlReader xr)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Xml.XmlReader | xr | The XML stream. |
Returns
| Type | Description |
|---|---|
| GridEngine | A GridEngine object. |
CreateGroup(Section)
Creates a Group.
Declaration
public override Group CreateGroup(Section parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Section | parent | The parent section. |
Returns
| Type | Description |
|---|---|
| Group | The new group. |
Overrides
CreateGroupDropArea(GridTableControl, GridGroupDropAreaModel)
Virtual method to create the GridGroupDropArea.
Declaration
public virtual GridGroupDropArea CreateGroupDropArea(GridTableControl tableControl, GridGroupDropAreaModel groupDropAreaModel)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableControl | tableControl | The table control. |
| GridGroupDropAreaModel | groupDropAreaModel | The GroupDropArea model. |
Returns
| Type | Description |
|---|---|
| GridGroupDropArea | The new group drop area. |
CreateGroupFooterSection(Group)
Creates a GroupFooterSection.
Declaration
public override GroupFooterSection CreateGroupFooterSection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| GroupFooterSection | The new group footer section. |
Overrides
CreateGroupHeaderSection(Group)
Creates a GroupHeaderSection.
Declaration
public override GroupHeaderSection CreateGroupHeaderSection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| GroupHeaderSection | The new group header section. |
Overrides
CreateGroupPreviewSection(Group)
Creates a GroupPreviewSection.
Declaration
public override GroupPreviewSection CreateGroupPreviewSection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | Parent group. |
Returns
| Type | Description |
|---|---|
| GroupPreviewSection | The new group preview section. |
Overrides
CreateGroupsDetails(Group)
Creates a GroupsDetails.
Declaration
public override GroupsDetails CreateGroupsDetails(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| GroupsDetails | The new details section. |
Overrides
CreateNestedTable(RecordNestedTablesPart)
Creates a NestedTable.
Declaration
public override NestedTable CreateNestedTable(RecordNestedTablesPart parent)
Parameters
| Type | Name | Description |
|---|---|---|
| RecordNestedTablesPart | parent | The parent element. |
Returns
| Type | Description |
|---|---|
| NestedTable | the new nested table. |
Overrides
CreateNestedTableControl(GridTableModel, GridTableControl, GridNestedTableControlCellRenderer)
Virtual method to create a GridNestedTableControl.
Declaration
public virtual GridNestedTableControl CreateNestedTableControl(GridTableModel relatedTableModel, GridTableControl parentGrid, GridNestedTableControlCellRenderer parentRenderer)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableModel | relatedTableModel | Provides the display element of the table. |
| GridTableControl | parentGrid | The parent control. |
| GridNestedTableControlCellRenderer | parentRenderer | The GridNestedTableControlCellRenderer which hosts this control. |
Returns
| Type | Description |
|---|---|
| GridNestedTableControl | The table control. |
CreateNestedTableControlCellModel(GridTableModel, GridTable)
Virtual method to create a GridNestedTableControlCellModel.
Declaration
public virtual GridNestedTableControlCellModel CreateNestedTableControlCellModel(GridTableModel model, GridTable relatedTable)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableModel | model | The table model. |
| GridTable | relatedTable | The related table. |
Returns
| Type | Description |
|---|---|
| GridNestedTableControlCellModel | The GridNestedTableControlCellModel. |
CreateRecord(Table)
Creates a Record.
Declaration
public override Record CreateRecord(Table parentTable)
Parameters
| Type | Name | Description |
|---|---|---|
| Table | parentTable | The parent table. |
Returns
| Type | Description |
|---|---|
| Record | The new record. |
Overrides
CreateRecordNavigationControl()
Virtual method to create the RecordNavigationControl.
Declaration
public virtual RecordNavigationControl CreateRecordNavigationControl()
Returns
| Type | Description |
|---|---|
| RecordNavigationControl | The RecordNavigationControl. |
CreateRecordNestedTablesPart(Record)
Creates a RecordNestedTablesPart.
Declaration
public override RecordNestedTablesPart CreateRecordNestedTablesPart(Record parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Record | parent | The parent record. |
Returns
| Type | Description |
|---|---|
| RecordNestedTablesPart | The new RecordNestedTablesPart. |
Overrides
CreateRecordPreviewRow(RecordPreviewRowsPart)
Creates a RecordPreviewRow.
Declaration
public override RecordPreviewRow CreateRecordPreviewRow(RecordPreviewRowsPart parent)
Parameters
| Type | Name | Description |
|---|---|---|
| RecordPreviewRowsPart | parent | The parent element. |
Returns
| Type | Description |
|---|---|
| RecordPreviewRow | The new record preview row. |
Overrides
CreateRecordRow(RecordRowsPart)
Creates a RecordRow.
Declaration
public override RecordRow CreateRecordRow(RecordRowsPart parent)
Parameters
| Type | Name | Description |
|---|---|---|
| RecordRowsPart | parent | The parent element. |
Returns
| Type | Description |
|---|---|
| RecordRow | The new record row. |
Overrides
CreateRecordRowsPart(Record)
Creates a RecordRowsPart.
Declaration
public override RecordRowsPart CreateRecordRowsPart(Record parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Record | parent | The parent record. |
Returns
| Type | Description |
|---|---|
| RecordRowsPart | The new RecordRowsPart. |
Overrides
CreateRecordsDetails(Group)
Creates a CreateRecordsDetails(Group).
Declaration
public override RecordsDetails CreateRecordsDetails(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| RecordsDetails | The new details section. |
Overrides
CreateRelationDescriptor()
Creates a RelationDescriptor.
Declaration
public override RelationDescriptor CreateRelationDescriptor()
Returns
| Type | Description |
|---|---|
| RelationDescriptor | The new relation descriptor. |
Overrides
CreateRowElementsSection(Group)
Creates a RowElementsSection.
Declaration
public override RowElementsSection CreateRowElementsSection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| RowElementsSection | The new row elements section. |
Overrides
CreateStackedHeaderSection(Group)
Creates a GridStackedHeaderSection element.
Declaration
public virtual Section CreateStackedHeaderSection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| Section | The new element. |
CreateSummarySection(Group)
Creates a GridSummarySection.
Declaration
public override Section CreateSummarySection(Group parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | parent | The parent group. |
Returns
| Type | Description |
|---|---|
| Section | The new summary section. |
Overrides
CreateTable(TableDescriptor, Table)
Creates a Table.
Declaration
public override Table CreateTable(TableDescriptor tableDescriptor, Table parentRelationTable)
Parameters
| Type | Name | Description |
|---|---|---|
| TableDescriptor | tableDescriptor | The table descriptor. |
| Table | parentRelationTable | Related parent table. |
Returns
| Type | Description |
|---|---|
| Table | The new table. |
Overrides
CreateTableControl(GridTableModel)
Virtual method to create a TableControl.
Declaration
public virtual GridTableControl CreateTableControl(GridTableModel model)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableModel | model | The GridTableModel. |
Returns
| Type | Description |
|---|---|
| GridTableControl | The new table control. |
CreateTableDescriptor(RelationDescriptor)
Creates a TableDescriptor.
Declaration
public override TableDescriptor CreateTableDescriptor(RelationDescriptor parentRelation)
Parameters
| Type | Name | Description |
|---|---|---|
| RelationDescriptor | parentRelation | Parent relation descriptor. |
Returns
| Type | Description |
|---|---|
| TableDescriptor | The new table descriptor. |
Overrides
CreateTableModel()
Virtual method to create the GridTableModel.
Declaration
public virtual GridTableModel CreateTableModel()
Returns
| Type | Description |
|---|---|
| GridTableModel | The table model used by the TableControl. |
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Overrides
EndInit()
Implements System.ComponentModel.ISupportInitialize.EndInit of the System.ComponentModel.ISupportInitialize interface.
Declaration
public void EndInit()
GetAppearance(Element)
The default GridTableCellAppearance with GridTableCellStyleInfo information for cells of this element.
Declaration
public static GridTableCellAppearance GetAppearance(Element el)
Parameters
| Type | Name | Description |
|---|---|---|
| Element | el | The element. |
Returns
| Type | Description |
|---|---|
| GridTableCellAppearance |
GetBaseAppearance(Element)
Returns a GridTableCellAppearance of the first parent element with appearance in the hierarchy.
Declaration
public static GridTableCellAppearance GetBaseAppearance(Element el)
Parameters
| Type | Name | Description |
|---|---|---|
| Element | el | The element to be queried. |
Returns
| Type | Description |
|---|---|
| GridTableCellAppearance |
GetDesignMode()
Determines whether the engine is attached to the control that is currently being designed in VisualStudio designer.
Declaration
public override bool GetDesignMode()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is in design mode. |
Overrides
GetGroupCaptionDisplayText(Group, String)
Returns the caption text for a group using a specified format.
Declaration
public static string GetGroupCaptionDisplayText(Group group, string format)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | group | The group that defines a set to records that belongs to a category. |
| System.String | format | See GroupOptions.CaptionText, e.g. "{CategoryCaption}: {Category} - {RecordCount} Items"; |
Returns
| Type | Description |
|---|---|
| System.String | Caption text for the group. |
GetGroupCaptionText(Group)
Returns the caption text for a group.
Declaration
public static string GetGroupCaptionText(Group group)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | group | The group that defines a set to records that belongs to a category. |
Returns
| Type | Description |
|---|---|
| System.String | Caption text for the group. |
GetGroupOptions(Group)
Gets the GroupOptions of a GridGroup or GridChildTable
Declaration
public static GridGroupOptionsStyleInfo GetGroupOptions(Group group)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | group | The GridGroup or GridChildTable |
Returns
| Type | Description |
|---|---|
| GridGroupOptionsStyleInfo | GroupOptions of the group. |
GetNestedAppearanceEvent(DescriptorPropertyChangedEventArgs, ref Object)
Checks if the DescriptorPropertyChangedEventArgs has nested event data and if the innermost event is the result of a change to an Appearance object. If so, the method will return the GridTableCellStyleInfoChangedEventArgs and the object whose appearance was modified.
GridTableCellStyleInfoChangedEventArgs tableCellStyleInfoChangedEventArgs = GetNestedAppearanceEvent(e, ref app);
IGridTableCellAppearanceSource appearanceHolder = app as IGridTableCellAppearanceSource;object app = tableDescriptor;
Declaration
public static GridTableCellStyleInfoChangedEventArgs GetNestedAppearanceEvent(DescriptorPropertyChangedEventArgs e, ref object appearanceHolder)
Parameters
| Type | Name | Description |
|---|---|---|
| DescriptorPropertyChangedEventArgs | e | Event data. |
| System.Object | appearanceHolder | The object holding the appearance settings. |
Returns
| Type | Description |
|---|---|
| GridTableCellStyleInfoChangedEventArgs | The inner event args that holds more information about the nested event. |
GetReadGroupOptions(Group)
If the groups GroupOptions were modified, the GroupOptions returns group object's GroupOptions; otherwise it returns a GridGroupOptionsStyleInfo of the first parent element with GroupOptions in the hierarchy.
Declaration
public static GridGroupOptionsStyleInfo GetReadGroupOptions(Group group)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | group | The GridGroup or GridChildTable |
Returns
| Type | Description |
|---|---|
| GridGroupOptionsStyleInfo | GroupOptions of the group. |
GetReadOnlyAppearance(Element)
If this element is modified, the Appearance returns this object's Appearance; otherwise it returns a GridTableCellAppearance of the first parent element with appearance in the hierarchy.
Declaration
public static GridTableCellAppearance GetReadOnlyAppearance(Element el)
Parameters
| Type | Name | Description |
|---|---|---|
| Element | el | The element. |
Returns
| Type | Description |
|---|---|
| GridTableCellAppearance | Appearance of this element. |
GetService(Type)
Gets the service object of the specified type.
Declaration
public override object GetService(Type service)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | service | The type of service object to get. |
Returns
| Type | Description |
|---|---|
| System.Object | Service object. |
Overrides
GetSummaryText(Group, GridSummaryColumnDescriptor)
Returns the formatted summary text for the given group, and summary column.
Declaration
public static string GetSummaryText(Group group, GridSummaryColumnDescriptor scd)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | group | The group that defines a set to records that belongs to a category. |
| GridSummaryColumnDescriptor | scd | The GridSummaryColumnDescriptor. |
Returns
| Type | Description |
|---|---|
| System.String | The summary formatted text as specified with GridSummaryColumnDescriptor.Format |
GetSummaryText(Group, String, String)
Returns the formatted summary text for the given group, summary row and column.
Declaration
public static string GetSummaryText(Group group, string summaryRowName, string summaryColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | group | The group that defines a set of records that belong to a category. |
| System.String | summaryRowName | The name of the GridSummaryRowDescriptor in the GridTableDescriptor.SummaryRows collection. |
| System.String | summaryColumnName | The name of the GridSummaryColumnDescriptor in the GridSummaryRowDescriptor.Summaries collection. |
Returns
| Type | Description |
|---|---|
| System.String | The summary formatted text as specified with GridSummaryColumnDescriptor.Format |
Remarks
See GridSummaryColumnDescriptor for an example.
GetTableDescriptor(String)
Returns the main table descriptor or a table descriptor that matches with the given name.
Declaration
public GridTableDescriptor GetTableDescriptor(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Descriptor name. |
Returns
| Type | Description |
|---|---|
| GridTableDescriptor | Table descriptor. |
GetXmlSerializer()
Returns the System.Xml.Serialization.XmlSerializer that can be used to serialize and deserialize this object to XML.
Declaration
public static XmlSerializer GetXmlSerializer()
Returns
| Type | Description |
|---|---|
| System.Xml.Serialization.XmlSerializer | The xml serializer. |
HasGroupOptions(Group)
Determines if GroupOptions were specified for a group.
Declaration
public static bool HasGroupOptions(Group group)
Parameters
| Type | Name | Description |
|---|---|---|
| Group | group | The GridGroup or GridChildTable |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if GroupOptions were specified. |
InitializeFrom(Engine)
Initializes this object and copies properties from another object.
Declaration
public override void InitializeFrom(Engine source)
Parameters
| Type | Name | Description |
|---|---|---|
| Engine | source | The source object. |
Overrides
OnBindingContextChanged(EventArgs)
Declaration
protected override void OnBindingContextChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
Overrides
OnParseCommonFormats(GridCellTextEventArgs)
Raises the ParseCommonFormats event.
Declaration
protected virtual void OnParseCommonFormats(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e | A GridCellTextEventArgs that contains the event data. |
OnQueryAddColumn(GridQueryAddColumnEventArgs)
Raises the QueryAddColumn event.
Declaration
protected virtual void OnQueryAddColumn(GridQueryAddColumnEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridQueryAddColumnEventArgs | e | A GridQueryAddColumnEventArgs that contains the event data. |
OnQueryAddVisibleColumn(GridQueryAddVisibleColumnEventArgs)
Raises the QueryAddVisibleColumn event.
Declaration
protected virtual void OnQueryAddVisibleColumn(GridQueryAddVisibleColumnEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridQueryAddVisibleColumnEventArgs | e | A GridQueryAddVisibleColumnEventArgs that contains the event data. |
OnQueryCellFormattedText(GridCellTextEventArgs)
Occurs the QueryCellFormattedText event.
Declaration
protected virtual void OnQueryCellFormattedText(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e | A GridCellTextEventArgs that contains the event data. |
OnQueryCellStyleInfo(GridTableCellStyleInfoEventArgs)
Raises the QueryCellStyleInfo event.
Declaration
protected virtual void OnQueryCellStyleInfo(GridTableCellStyleInfoEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableCellStyleInfoEventArgs | e | A GridTableCellStyleInfoEventArgs that contains the event data. |
OnQueryCellText(GridCellTextEventArgs)
Occurs the QueryCellText event.
Declaration
protected virtual void OnQueryCellText(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e | A GridCellTextEventArgs that contains the event data. |
OnQueryCoveredRange(GridTableQueryCoveredRangeEventArgs)
Occurs the QueryCoveredRange event.
Declaration
protected virtual void OnQueryCoveredRange(GridTableQueryCoveredRangeEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableQueryCoveredRangeEventArgs | e | A GridTableCellStyleInfoEventArgs that contains the event data. |
OnQueryCustomSummary(GridQueryCustomSummaryEventArgs)
Raises the QueryCustomSummary event.
Declaration
protected virtual void OnQueryCustomSummary(GridQueryCustomSummaryEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridQueryCustomSummaryEventArgs | e | A GridQueryCustomSummaryEventArgs that contains the event data. |
OnQueryValue(FieldValueEventArgs)
Declaration
protected override void OnQueryValue(FieldValueEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| FieldValueEventArgs | e |
Overrides
OnSaveCellFormattedText(GridCellTextEventArgs)
Occurs the SaveCellFormattedText event.
Declaration
protected virtual void OnSaveCellFormattedText(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e | A GridCellTextEventArgs that contains the event data. |
OnSaveCellText(GridCellTextEventArgs)
Occurs the SaveCellText event.
Declaration
protected virtual void OnSaveCellText(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e | A GridCellTextEventArgs that contains the event data. |
OnSaveValue(FieldValueEventArgs)
Declaration
protected override void OnSaveValue(FieldValueEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| FieldValueEventArgs | e |
Overrides
OnTableDescriptorCreated(EventArgs)
Declaration
protected override void OnTableDescriptorCreated(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
Overrides
RaiseParseCommonFormats(GridCellTextEventArgs)
Used internally.
Declaration
public void RaiseParseCommonFormats(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e |
RaiseQueryAddColumn(GridQueryAddColumnEventArgs)
Raises the QueryAddColumn event.
Declaration
public void RaiseQueryAddColumn(GridQueryAddColumnEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridQueryAddColumnEventArgs | e | A GridQueryAddColumnEventArgs that contains the event data. |
RaiseQueryAddVisibleColumn(GridQueryAddVisibleColumnEventArgs)
Raises the QueryAddVisibleColumn event.
Declaration
public void RaiseQueryAddVisibleColumn(GridQueryAddVisibleColumnEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridQueryAddVisibleColumnEventArgs | e | A GridQueryAddVisibleColumnEventArgs that contains the event data. |
RaiseQueryCellFormattedText(GridCellTextEventArgs)
Used internally.
Declaration
public void RaiseQueryCellFormattedText(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e |
RaiseQueryCellText(GridCellTextEventArgs)
Used internally.
Declaration
public void RaiseQueryCellText(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e |
RaiseSaveCellFormattedText(GridCellTextEventArgs)
Used internally.
Declaration
public void RaiseSaveCellFormattedText(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e |
RaiseSaveCellText(GridCellTextEventArgs)
Used internally.
Declaration
public void RaiseSaveCellText(GridCellTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellTextEventArgs | e |
Reset()
Declaration
public override void Reset()
Overrides
ResetAppearance()
Discards any changes for the Appearance object.
Declaration
public void ResetAppearance()
ResetAppearance(Element)
Discards any changes for the Appearance object.
Declaration
public static void ResetAppearance(Element el)
Parameters
| Type | Name | Description |
|---|---|---|
| Element | el | An element that implements the IGridTableCellAppearanceSource interface. |
ResetBaseStyles()
Resets the BaseStyles property.
Declaration
public void ResetBaseStyles()
ResetChildGroupOptions()
Discards any changes for the ChildGroupOptions object.
Declaration
public void ResetChildGroupOptions()
ResetDefaultAppearance()
Discards any changes for the Appearance object.
Declaration
public void ResetDefaultAppearance()
ResetInvalidateAllWhenListChanged()
Discards any changes for the InvalidateAllWhenListChanged property.
Declaration
public void ResetInvalidateAllWhenListChanged()
ResetNestedTableGroupOptions()
Discards any changes for the NestedTableGroupOptions object.
Declaration
public void ResetNestedTableGroupOptions()
ResetTableOptions()
Discards any changes for the IGridTableOptionsSource object.
Declaration
public void ResetTableOptions()
ResetTopLevelGroupOptions()
Discards any changes for the TopLevelGroupOptions object.
Declaration
public void ResetTopLevelGroupOptions()
SetParentControl(GridGroupingControl)
Internal helper routine that helps attaching the engine to a parent GridGroupingControl when multiple GridGroupingControls share the same engine object. This event lets you choose the one GridGroupingControl that should be treated as the main control for this engine.
Declaration
public void SetParentControl(GridGroupingControl parentControl)
Parameters
| Type | Name | Description |
|---|---|---|
| GridGroupingControl | parentControl | The parent control. |
ShouldSerializeAppearance()
Determines whether Appearance has been modified and contents should be serialized at design-time.
Declaration
public bool ShouldSerializeAppearance()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if contents were changed; False otherwise. |
ShouldSerializeAppearance(Element)
Determines whether Appearance has been modified and contents should be serialized at design-time.
Declaration
public static bool ShouldSerializeAppearance(Element el)
Parameters
| Type | Name | Description |
|---|---|---|
| Element | el | The element. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if contents were changed; False otherwise. |
ShouldSerializeBaseStyles()
Determines whether the BaseStyles collection was modified.
Declaration
public bool ShouldSerializeBaseStyles()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the collection was modified. |
ShouldSerializeChildGroupOptions()
Determines whether ChildGroupOptions were modified and contents should be serialized at design-time.
Declaration
public bool ShouldSerializeChildGroupOptions()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if contents were changed; False otherwise. |
ShouldSerializeInvalidateAllWhenListChanged()
Determines whether the value of the InvalidateAllWhenListChanged property was modified.
Declaration
public bool ShouldSerializeInvalidateAllWhenListChanged()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is modified. |
ShouldSerializeNestedTableGroupOptions()
Determines whether TopLevelGroupOptions were modified and contents should be serialized at design-time.
Declaration
public bool ShouldSerializeNestedTableGroupOptions()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if contents were changed; False otherwise. |
ShouldSerializeTableOptions()
Determines whether TopLevelGroupOptions were modified and contents should be serialized at design-time.
Declaration
public bool ShouldSerializeTableOptions()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if contents were changed; False otherwise. |
ShouldSerializeTopLevelGroupOptions()
Determines whether TopLevelGroupOptions were modified and contents should be serialized at design-time.
Declaration
public bool ShouldSerializeTopLevelGroupOptions()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if contents were changed; False otherwise. |
WriteXml(TextWriter)
Saves the engine changes to an XML stream.
Declaration
public void WriteXml(TextWriter w)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.TextWriter | w | The System.IO.TextWriter. |
WriteXml(XmlWriter)
Saves the engine changes to an XML stream.
Declaration
public virtual void WriteXml(XmlWriter xw)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Xml.XmlWriter | xw | The XMLWriter. |
Events
ParseCommonFormats
Use this event to provide support for parsing the formatted string and convert it into the the underlying cell's value considering Format and CellValueType.
This event is raised from GridCellModelBase.ApplyFormattedText after SaveCellFormattedText was raised. The event is raised only if the SaveCellFormattedText did not set e.Handled.
Declaration
public event GridCellTextEventHandler ParseCommonFormats
Event Type
| Type |
|---|
| GridCellTextEventHandler |
Remarks
The grid has built-in support for parsing the Percent format (Format = "P") and Hexadecimal format (Format = "X"). You should handle this event if you want to add support for other formats.
GridCellTextEventArgs has information about the style settings of the cell. You can inspect that style to get information about Format and CellValueType of the cell.
QueryAddColumn
The GridEngine.QueryAddColumn event affects the auto-population of the GridColumnDescriptorCollection.
It is called for each column and lets you control at run-time if the column should be added to the GridColumnDescriptorCollection. You can set e.Cancel = True to avoid specific columns being added.
Declaration
public event GridQueryAddColumnEventHandler QueryAddColumn
Event Type
| Type |
|---|
| GridQueryAddColumnEventHandler |
Remarks
Handling through a GridQueryAddColumnEventArgs
QueryAddVisibleColumn
The QueryAddVisibleColumn event affects the auto-population of the GridVisibleColumnDescriptorCollection.
It is called for each column and lets you control at run-time if the column should be added to the GridVisibleColumnDescriptorCollection. You can set e.Cancel = True to avoid specific columns being added.
Declaration
public event GridQueryAddVisibleColumnEventHandler QueryAddVisibleColumn
Event Type
| Type |
|---|
| GridQueryAddVisibleColumnEventHandler |
Remarks
Handling through a GridQueryAddVisibleColumnEventArgs
QueryCellFormattedText
Occurs each time the FormattedText is called to get the formatted string that represents the underlying cell's value considering Format.
Declaration
public event GridCellTextEventHandler QueryCellFormattedText
Event Type
| Type |
|---|
| GridCellTextEventHandler |
Remarks
This event allows you to customize how to format a cell's value as string at run-time on demand based on Format.
If you do want to customize the grid's default formatting, you should assign the resulting string to Text and set Handled to True. The grid will check this flag to see whether it should return Text or use a default formatting routine.
If you need identity information about the cell such as row and column index, you can get that information by querying the CellIdentity of the Style object.
See Also
QueryCellStyleInfo
Occurs for each cell before a GridTableControl starts painting and lets users customize the display of cells.
Declaration
public event GridTableCellStyleInfoEventHandler QueryCellStyleInfo
Event Type
| Type |
|---|
| GridTableCellStyleInfoEventHandler |
QueryCellText
Occurs each time the Text is called to get the raw string that represents the underlying cell's value.
Declaration
public event GridCellTextEventHandler QueryCellText
Event Type
| Type |
|---|
| GridCellTextEventHandler |
Remarks
This event allows you to customize how to represent a cell's value as string at run-time on demand.
If you do want to customize the grid's default conversion, you should assign the result string to Text and set Handled to True. The grid will check this flag to see whether it should return Text or use a default conversion.
If you need identity information about the cell such as row and column index, you can get that information by querying CellIdentity of the Style object.
See Also
QueryCoveredRange
Occurs to determine if the cell belongs to a covered range and returns the covered range of the cell or the cell itself as GridRangeInfo if it is not a covered range.
Declaration
public event GridTableQueryCoveredRangeEventHandler QueryCoveredRange
Event Type
| Type |
|---|
| GridTableQueryCoveredRangeEventHandler |
QueryCustomSummary
Occurs for each GridSummaryColumnDescriptor before the SummaryDescriptor is determined. You must handle this event if you specified Custom as SummaryType.
Declaration
public event GridQueryCustomSummaryEventHandler QueryCustomSummary
Event Type
| Type |
|---|
| GridQueryCustomSummaryEventHandler |
SaveCellFormattedText
Occurs each time the FormattedText is called to parse the formatted string that represents the underlying cell's value considering Format and CellValueType.
Declaration
public event GridCellTextEventHandler SaveCellFormattedText
Event Type
| Type |
|---|
| GridCellTextEventHandler |
Remarks
This event allows you to customize how to parse the formatted text into a cell value at run-time on demand.
If you do want to customize the grid's default parsing behavior, you should assign the resulting value to the CellValue of the GridStyleInfo object and set Handled to True. The grid will check this flag to see whether it should accept your modification or use a default parsing routine.
If you need identity information about the cell such as row and column index, you can get that information by querying the CellIdentity of the Style object.
This event is normally called from within GridStyleInfo, which is called when the user enters text into a text box or when text is assigned to FormattedText. ApplyFormattedText method checks if there are event handlers for SaveCellFormattedText and if the Handled is not set, they try to convert the input text into the type specified with CellValueType.
If this conversion fails, ApplyFormattedText(GridStyleInfo, String, Int32) will check StrictValueType. If it is True, an exception is thrown which itself results in a warning message displayed to the user at the time from CurrentCellValidating.
If you set StrictValueType to False, ApplyFormattedText(GridStyleInfo, String, Int32) will not throw an exception and simply store the text as CellValue.
If you need a more specialized customization of this behavior, you should handle the SaveCellFormattedText event. This lets you parse the text input and change the cells CellValueType at run-time. See the attached example.
Examples
This example parses the text input and changes the cell's CellValueType at run-time if the input does not match the current CellValueType.
void InitializeComponent()
{
// initialize code
// ...
this.gridControl1.SaveCellText += new Syncfusion.Windows.Forms.Grid.GridCellTextEventHandler(this.gridControl1_SaveCellText);
this.gridControl1.QueryCellFormattedText += new Syncfusion.Windows.Forms.Grid.GridCellTextEventHandler(this.gridControl1_QueryCellFormattedText);
this.gridControl1.SaveCellFormattedText += new Syncfusion.Windows.Forms.Grid.GridCellTextEventHandler(this.gridControl1_SaveCellFormattedText);
this.gridControl1.QueryCellText += new Syncfusion.Windows.Forms.Grid.GridCellTextEventHandler(this.gridControl1_QueryCellText);
}
private void gridControl1_QueryCellFormattedText(object sender, Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs e)
{
}
private void gridControl1_QueryCellText(object sender, Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs e)
{
}
private void gridControl1_SaveCellText(object sender, Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs e)
{
ParseText(e);
}
private void gridControl1_SaveCellFormattedText(object sender, GridCellTextEventArgs e)
{
ParseText(e);
}
void ParseText(GridCellTextEventArgs e)
{
// By default, the grid will display a warning message box informing the user
// the entered value is not valid and the user will have to change the value.
//
// In this event handler, we change the grid default's behavior such that
// when the user enters a value that does not fit the cell's CellValueType,
// the input text is accepted and no warning message is shown.
if (e.Handled)
return;
System.Globalization.CultureInfo ci = e.Style.CultureInfo;
System.Globalization.NumberFormatInfo nfi = ci != null ? ci.NumberFormat : null;
try
{
e.Style.CellValue = GridCellValueConvert.Parse(e.Text, e.Style.CellValueType, nfi, e.Style.Format);
}
catch (Exception ex)
{
if (ex is FormatException || ex.InnerException is FormatException)
{
e.Style.CellValue = e.Text;
// possibly could also change CellValueType here
e.Style.CellValueType = typeof(string);
// - or -
// you could also further analyze the input text and assign a type
// that fits the input text, e.g.
// e.Style.CellValueType = typeof(datetime);
// - or -
// e.Style.CellValueType = typeof(decimal);
// etc.
}
else
throw;
}
e.Handled = true;
}
Private Sub InitializeComponent()
' Initalize code
' ...
AddHandler Me.gridControl1.SaveCellText, AddressOf Me.gridControl1_SaveCellText
AddHandler Me.gridControl1.QueryCellFormattedText, AddressOf Me.gridControl1_QueryCellFormattedText
AddHandler Me.gridControl1.SaveCellFormattedText, AddressOf Me.gridControl1_SaveCellFormattedText
AddHandler Me.gridControl1.QueryCellText, AddressOf Me.gridControl1_QueryCellText
End Sub 'InitializeComponent
Private Sub gridControl1_QueryCellFormattedText(sender As Object, e As Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs)
End Sub 'gridControl1_QueryCellFormattedText
Private Sub gridControl1_QueryCellText(sender As Object, e As Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs)
End Sub 'gridControl1_QueryCellText
Private Sub gridControl1_SaveCellText(sender As Object, e As Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs)
ParseText(e)
End Sub 'gridControl1_SaveCellText
Private Sub gridControl1_SaveCellFormattedText(sender As Object, e As GridCellTextEventArgs)
ParseText(e)
End Sub 'gridControl1_SaveCellFormattedText
Sub ParseText(e As GridCellTextEventArgs)
' By default, the grid will display a warning message box informing the user
' the entered value is not valid and the user will have to change the value.
'
' In this event handler we change the grid default's behavior such that
' when the user enters a value that does not fit the cell's CellValueType,
' the input text is accepted and no warning message is shown.
If e.Handled Then
Return
End If
Dim ci As System.Globalization.CultureInfo = e.Style.CultureInfo
Dim nfi As System.Globalization.NumberFormatInfo = Nothing
If (Not (ci Is Nothing)) Then nfi = ci.NumberFormat
Try
e.Style.CellValue = GridCellValueConvert.Parse(e.Text, e.Style.CellValueType, nfi, e.Style.Format)
Catch ex As Exception
If TypeOf ex Is FormatException OrElse TypeOf ex.InnerException Is FormatException Then
e.Style.CellValue = e.Text
' possibly could also change CellValueType here
' e.Style.CellValueType = typeof(string);
' - or -
' you could also further analyze the input text and assign a type
' that fits the input text, e.g.
' e.Style.CellValueType = typeof(datetime);
' - or -
' e.Style.CellValueType = typeof(decimal);
' etc.
Else
Throw
End If
End Try
e.Handled = True
End Sub 'ParseText
See Also
SaveCellText
Occurs each time the Text is called to set the unformatted string that represents the underlying cell's value.
Declaration
public event GridCellTextEventHandler SaveCellText
Event Type
| Type |
|---|
| GridCellTextEventHandler |
Remarks
This event allows you to customize how to parse the unformatted text into a cell value at run-time on demand.
If you do want to customize the grid's default parsing behavior, you should assign the resulting value to the CellValue of the GridStyleInfo object and set Handled to True. The grid will check this flag to see whether it should accept your modification or use a default parsing routine.
If you need identity information about the cell such as row and column index, query the CellIdentity of the Style object.
See the SaveCellFormattedText event for further discussion since these two events are very similar. Often you will need to handle both events in your code in the same way.
See Also
Explicit Interface Implementations
IGridGroupOptionsSource.Engine
Declaration
GridEngine IGridGroupOptionsSource.Engine { get; }
Returns
| Type |
|---|
| GridEngine |
IGridGroupOptionsSource.GetParentGroupOptionsSource()
Declaration
IGridGroupOptionsSource IGridGroupOptionsSource.GetParentGroupOptionsSource()
Returns
| Type |
|---|
| IGridGroupOptionsSource |
IGridGroupOptionsSource.GroupOptions
Declaration
GridGroupOptionsStyleInfo IGridGroupOptionsSource.GroupOptions { get; }
Returns
| Type |
|---|
| GridGroupOptionsStyleInfo |
IGridGroupOptionsSource.HasGroupOptions
Declaration
bool IGridGroupOptionsSource.HasGroupOptions { get; }
Returns
| Type |
|---|
| System.Boolean |
IGridGroupOptionsSource.RaiseGroupOptionsChanged(GridGroupOptionsChangedEventArgs)
Declaration
void IGridGroupOptionsSource.RaiseGroupOptionsChanged(GridGroupOptionsChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridGroupOptionsChangedEventArgs | e |
IGridGroupOptionsSource.RaiseGroupOptionsChanging(GridGroupOptionsChangedEventArgs)
Declaration
void IGridGroupOptionsSource.RaiseGroupOptionsChanging(GridGroupOptionsChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridGroupOptionsChangedEventArgs | e |
IGridTableCellAppearanceSource.Engine
Declaration
GridEngine IGridTableCellAppearanceSource.Engine { get; }
Returns
| Type |
|---|
| GridEngine |
IGridTableCellAppearanceSource.GetAppearance()
Declaration
GridTableCellAppearance IGridTableCellAppearanceSource.GetAppearance()
Returns
| Type |
|---|
| GridTableCellAppearance |
IGridTableCellAppearanceSource.GetBaseAppearance()
Declaration
GridTableCellAppearance IGridTableCellAppearanceSource.GetBaseAppearance()
Returns
| Type |
|---|
| GridTableCellAppearance |
IGridTableCellAppearanceSource.RaiseAppearanceChanged(GridTableCellStyleInfoChangedEventArgs)
Declaration
void IGridTableCellAppearanceSource.RaiseAppearanceChanged(GridTableCellStyleInfoChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableCellStyleInfoChangedEventArgs | e |
IGridTableCellAppearanceSource.RaiseAppearanceChanging(GridTableCellStyleInfoChangedEventArgs)
Declaration
void IGridTableCellAppearanceSource.RaiseAppearanceChanging(GridTableCellStyleInfoChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableCellStyleInfoChangedEventArgs | e |
IGridTableOptionsSource.Engine
Declaration
GridEngine IGridTableOptionsSource.Engine { get; }
Returns
| Type |
|---|
| GridEngine |
IGridTableOptionsSource.GetParentTableOptionsSource()
Declaration
IGridTableOptionsSource IGridTableOptionsSource.GetParentTableOptionsSource()
Returns
| Type |
|---|
| IGridTableOptionsSource |
IGridTableOptionsSource.HasTableOptions
Declaration
bool IGridTableOptionsSource.HasTableOptions { get; }
Returns
| Type |
|---|
| System.Boolean |
IGridTableOptionsSource.RaiseTableOptionsChanged(GridTableOptionsChangedEventArgs)
Declaration
void IGridTableOptionsSource.RaiseTableOptionsChanged(GridTableOptionsChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableOptionsChangedEventArgs | e |
IGridTableOptionsSource.RaiseTableOptionsChanging(GridTableOptionsChangedEventArgs)
Declaration
void IGridTableOptionsSource.RaiseTableOptionsChanging(GridTableOptionsChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridTableOptionsChangedEventArgs | e |