Class SfDataGrid
Represents a control that displays the data in a tabular format.
Implements
Inherited Members
Namespace: Syncfusion.WinForms.DataGrid
Assembly: Syncfusion.SfDataGrid.WinForms.dll
Syntax
public class SfDataGrid : BaseControl, IThemeProvider, IVisualStyle, IDisposable, INotifyPropertyChanged, ISupportInitialize, IDetailsViewNotifier
Remarks
The SFDataGrid control provides a flexible way to manage data and the set built-in column types allows the data to be displayed in to appropriate editor.
Constructors
SfDataGrid()
Initializes a new instance of the SfDataGrid class.
Declaration
public SfDataGrid()
Properties
AddNewRowPosition
Gets or sets the position of the AddNewRow in the SfDataGrid.
Declaration
[Cloneable(true)]
public RowPosition AddNewRowPosition { get; set; }
Property Value
Type | Description |
---|---|
RowPosition | One of the |
AddNewRowText
Gets or sets the text of the add new row.
Declaration
[Cloneable(true)]
public string AddNewRowText { get; set; }
Property Value
Type |
---|
System.String |
AdvancedFilterType
Gets or sets the filter type for advanced filter such as Text, Numeric or Date filter.
Declaration
[Cloneable(true)]
public AdvancedFilterType AdvancedFilterType { get; set; }
Property Value
Type |
---|
AdvancedFilterType |
AllowDeleting
Gets or sets a value indicating whether the user can delete the record rows by pressing Delete key.
Declaration
[Cloneable(true)]
public bool AllowDeleting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the user can delete the rows; otherwise, false. The default value is false. |
Remarks
To delete the selected record rows, the current cell must be in record row and must not in editing mode. The deleting operations can be handled through RecordDeleting and RecordDeleted event handlers in SfDataGrid.
AllowDraggingColumns
Gets or sets a value indicating whether the column can be repositioned by using mouse or touch.
Declaration
[Cloneable(true)]
public bool AllowDraggingColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the user can drag and drop the column to another column; otherwise, false. The default value is false. |
AllowEditing
Gets or sets a value indicating whether editing is allowed for the grid or not.
Declaration
[Cloneable(true)]
public bool AllowEditing { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowFiltering
Gets or sets a value indicating whether the UI level filtering can be enabled for all the columns in SfDataGrid.
Highest priority will be considered for the
Declaration
[Cloneable(true)]
public bool AllowFiltering { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowGrouping
Gets or sets a value indicating whether the user can drag and drop the column to GroupDropArea.
Declaration
[Cloneable(true)]
public bool AllowGrouping { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the user can drag and drop the column to GroupDropArea; otherwise, false. The default value is true. |
AllowResizingColumns
Gets or sets a value indicating whether the column resizing option can be enabled for the data grid.
Declaration
[Cloneable(true)]
public bool AllowResizingColumns { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowResizingHiddenColumns
Gets or sets a value indicating whether the hidden column resizing option is can be enabled for the data grid.
Declaration
[Cloneable(true)]
public bool AllowResizingHiddenColumns { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowSelectionOnMouseDown
Gets or sets a value indicating whether the selection should be present in the MouseDown state.
Declaration
[Cloneable(true)]
public bool AllowSelectionOnMouseDown { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the row or cell is selected in PointerPressed; otherwise , false. The default value is false. |
AllowSorting
Gets or sets a value indicating whether the user can sort the data by clicking on its header cell of the column in SFDataGrid.
Declaration
[Cloneable(true)]
public bool AllowSorting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the sorting is enabled ; otherwise, false. The default value is true. |
Remarks
The SortColumnsChanging and SortColumnsChanged events occurs , when the sorting operation is performed. You can cancel or customize the sorting operation through SortColumnsChanging event handler.
AllowStandardTab
Gets or sets a value indicating whether the TAB key moves the focus to the next control in the tab order rather than moving focus to the next cell in the control.
Declaration
[Cloneable(true)]
public bool AllowStandardTab { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowTriStateSorting
Gets or sets a value indicating whether the user can sort the data to its initial order other than ascending or descending order.
Declaration
[Cloneable(true)]
public bool AllowTriStateSorting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the data is arranged to initial order; otherwise, false. The default value is false. |
AutoExpandGroups
Gets or sets a value indicating whether the group caption is expanded automatically during grouping.
Declaration
[Cloneable(true)]
public bool AutoExpandGroups { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the group caption is expanded automatically, otherwise false. |
AutoFitGroupDropAreaItem
Gets or sets a value indicating whether to auto fit the group drop items.
Declaration
public bool AutoFitGroupDropAreaItem { get; set; }
Property Value
Type |
---|
System.Boolean |
AutoGenerateColumns
Gets or sets a value indicating whether the columns should be created automatically.
Declaration
[Cloneable(true)]
public bool AutoGenerateColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the columns are automatically generated; otherwise , false. The default value is true. |
Remarks
Each column gets notified in the
AutoGenerateColumnsForCustomType
Gets or sets a value indicating whether columns should be created automatically for the custom types in underlying data object.
Declaration
public bool AutoGenerateColumnsForCustomType { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
If AutoGenerateColumnsForCustomType property is set to true, columns for inner properties will be generated. For example, OrderInfo class has Customer property of type Customer, then columns will be generated for Customer�s properties like Customer.CustomerID, Customer.CustomerName
AutoGenerateColumnsMode
Gets or sets a value that indicates how the columns should be generated during automatic column generation.
Declaration
[Cloneable(true)]
public AutoGenerateColumnsMode AutoGenerateColumnsMode { get; set; }
Property Value
Type |
---|
AutoGenerateColumnsMode |
AutoGenerateColumnsModeForCustomType
Gets or sets a value that indicates how the columns should be generated during automatic column generation for custom type.
Declaration
[Cloneable(true)]
public AutoGenerateColumnsModeForCustomType AutoGenerateColumnsModeForCustomType { get; set; }
Property Value
Type |
---|
AutoGenerateColumnsModeForCustomType |
AutoGenerateRelations
Gets or sets a value indicating whether the relations should be generated automatically.
Declaration
[Cloneable(true)]
public bool AutoGenerateRelations { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the relations are automatically generated; otherwise , false. The default value is true. |
AutoSizeColumnsMode
Gets or sets the value that indicates how all the columns widths of the SfDataGrid are determined.
Declaration
[Cloneable(true)]
public AutoSizeColumnsMode AutoSizeColumnsMode { get; set; }
Property Value
Type |
---|
AutoSizeColumnsMode |
AutoSizeController
Gets or sets the AutoSizeController which controls the auto sizing operation of column widths of the SfDataGrid.
Declaration
[Cloneable(false)]
public AutoSizeController AutoSizeController { get; set; }
Property Value
Type |
---|
AutoSizeController |
BackColor
Gets or sets the background color for the control.
Declaration
public override Color BackColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
CaptionSummaryRow
Gets or sets the GridSummaryRow that displays the summary information at the header of each group .
Declaration
[Cloneable(true)]
public GridSummaryRow CaptionSummaryRow { get; set; }
Property Value
Type | Description |
---|---|
GridSummaryRow | The GridSummaryRow to display the summary information at the header of each group .The default value is null. |
Remarks
Each group can have only one caption summary and the summary value is calculated over all the records with in the group.
CellRenderers
Gets the reference to the GridCellRendererCollection instance which
holds the collection of all predefined cell renderer
Declaration
[Cloneable(false)]
public GridCellRendererCollection CellRenderers { get; }
Property Value
Type |
---|
GridCellRendererCollection |
Remarks
The cell renderer provides various properties and virtual methods to customize its operations. When any of the predefined renderer is customized , that should be replaced to the CellRenderers collection with its appropriate cell type. The below table shows the predefined renderer and its corresponding cell type associated with column.
Examples
//The customized GridCellTextBoxRendererExt is replaced to CellRenderers collection after removed the default renderer of GridTextColumn.
this.dataGrid.CellRenderers.Remove("TextBox");
this.dataGrid.CellRenderers.Add("TextBox",new GridCellTextBoxRendererExt());
ClipboardController
Gets or sets an instance of the
Declaration
[Cloneable(false)]
public IDataGridClipboardController ClipboardController { get; set; }
Property Value
Type | Description |
---|---|
IDataGridClipboardController | An instance of class that derives from |
Remarks
The
ColumnCount
Gets the columns count for the SFDataGrid.
Declaration
[Cloneable(false)]
public int ColumnCount { get; }
Property Value
Type |
---|
System.Int32 |
ColumnDragDropController
Gets or sets the ColumnDragDropController for drag and drop the header.
Declaration
[Cloneable(false)]
public ColumnDragDropController ColumnDragDropController { get; set; }
Property Value
Type |
---|
ColumnDragDropController |
Examples
The following example show how to initialize the custom drag and drop controller.
//Initializes the custom drag and drop controller
sfDataGrid1.ColumnDragDropController = new CustomDragAndDropController(sfDataGrid1.TableControl, sfDataGrid1.GroupPanel);
public class CustomDragAndDropController : ColumnDragDropController
{
public CustomDragAndDropController(TableControl tableControl, GroupPanel groupPanel)
: base(tableControl, groupPanel)
{
}
protected override bool CanShowPopup(GridColumn column)
{
if(column.MappingName == "UnitPrice")
return false;
return base.CanShowPopup(column);
}
protected override void PopupDroppedOnHeaderRow(int oldIndex, int newIndex)
{
if (newIndex == 0)
return;
base.PopupDroppedOnHeaderRow(oldIndex, newIndex);
}
protected override void PopupDroppedOnGroupDropArea(GridColumn draggingColumn, MouseEventArgs e)
{
if (draggingColumn.MappingName == "OrderID")
return;
base.PopupDroppedOnGroupDropArea(draggingColumn, e);
}
}
ColumnHeaderContextMenu
Gets or sets the context menu that appears on each column header cells.
Declaration
[Cloneable(true)]
public ContextMenuStrip ColumnHeaderContextMenu { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ContextMenuStrip |
ColumnResizingController
Gets or sets the column resizing controller for the SfDataGrid.
Declaration
[Cloneable(false)]
public ColumnResizingController ColumnResizingController { get; set; }
Property Value
Type |
---|
ColumnResizingController |
Examples
//Sets the custom resizing controller for data grid.
sfDataGrid1.ColumnResizingController = new CustomResizingController(sfDataGrid1)
public class CustomResizingController : ColumnResizingController
{
public CustomResizingController(SfDataGrid dataGrid) :
base(dataGrid)
{ }
protected override void ProcessResizing(MouseEventArgs e, GridColumn column)
{
if (column.MappingName == "OrderID")
return;
base.ProcessResizing(e, column);
}
protected override void SetColumnWidth(int index, int width)
{
base.SetColumnWidth(index, width);
}
}
Columns
Gets or sets the collection that contains all the columns in SfDataGrid .
Declaration
[Cloneable(true)]
public Columns Columns { get; set; }
Property Value
Type | Description |
---|---|
Columns | The collection that contains all the columns in SFDataGrid. This property has no default value. |
Remarks
Each column associated with its own renderer and it controls the corresponding column related operations.
CopyOption
Gets or sets the value which indicates whether how the content is copied from SfDataGrid control to the clipboard.
Declaration
[Cloneable(true)]
public CopyOptions CopyOption { get; set; }
Property Value
Type | Description |
---|---|
CopyOptions | The default value is |
Remarks
You can cancel or customize the copy operation through
CreateParams
Overridden to set the border style of the data grid.
Declaration
protected override CreateParams CreateParams { get; }
Property Value
Type |
---|
System.Windows.Forms.CreateParams |
CurrentCell
Gets or sets the currently active cell.
Declaration
[Cloneable(false)]
public CurrentCellManager CurrentCell { get; set; }
Property Value
Type |
---|
CurrentCellManager |
CurrentItem
Gets or sets the current item of SFDataGrid.
Declaration
[Cloneable(false)]
public object CurrentItem { get; set; }
Property Value
Type |
---|
System.Object |
DataMember
Gets or sets the name of the table in the data source.
Declaration
public string DataMember { get; set; }
Property Value
Type |
---|
System.String |
Remarks
This property is useful when binding to a DataSet that contains multiple tables. You do not need to set this property when binding to a DataSet that contains single table. For example, you can bind a grid control to a DataSet that contains a single table without setting this property. If the DataSet contains multiple tables, you must set this property to the name of one of the tables.
DataSource
Gets or sets the collection that is used to generate the content of the SfDataGrid.
Declaration
[Cloneable(false)]
public object DataSource { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The collection that is used to generate the content of the SfDataGrid.The default value is null. |
Remarks
DetailsViewDefinitions
Gets or sets the collection of ViewDefinition to maintain the hierarchical relations.
Declaration
[Cloneable(true)]
public DetailsViewDefinitions DetailsViewDefinitions { get; set; }
Property Value
Type |
---|
DetailsViewDefinitions |
DetailsViewPadding
Gets or sets a value indicating the padding of the DetailsView.
Declaration
[Cloneable(true)]
public Padding DetailsViewPadding { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Padding |
EditMode
Gets or sets a value indicating the mode of editing.
Declaration
[Cloneable(true)]
public EditMode EditMode { get; set; }
Property Value
Type |
---|
EditMode |
Remarks
Specfies that the cell should goes to editing based on whether SingleClick or DoubleClick.
EditorSelectionBehavior
Gets or sets a value indicating the selection behavior on edit mode.
Declaration
[Cloneable(true)]
public EditorSelectionBehavior EditorSelectionBehavior { get; set; }
Property Value
Type |
---|
EditorSelectionBehavior |
Remarks
Specifies the selection behavior. i.e., Should select the text or cursor position specifying option while edit mode.
EnableDataVirtualization
Gets or sets a value indicating whether to create the RecordEntry for all the objects in SourceCollection.
Declaration
[Cloneable(true)]
public bool EnableDataVirtualization { get; set; }
Property Value
Type |
---|
System.Boolean |
ExpanderColumnWidth
Gets or sets a value indicating the expander column width.
Declaration
[Cloneable(true)]
public double ExpanderColumnWidth { get; set; }
Property Value
Type |
---|
System.Double |
FilterDelay
Gets or sets the filter delay in milliseconds for applying the immediate filtering using the filter row.
Declaration
[Cloneable(true)]
public int FilterDelay { get; set; }
Property Value
Type |
---|
System.Int32 |
FilterPopupMode
Gets or sets the filter pop up mode of the UI filter.
Declaration
[Cloneable(true)]
public FilterPopupMode FilterPopupMode { get; set; }
Property Value
Type |
---|
FilterPopupMode |
FilterRowCellRenderers
Gets the reference to the GridCellRendererCollection instance which holds the collection of all predefined filter row cell renderer.
Declaration
[Cloneable(false)]
public GridCellRendererCollection FilterRowCellRenderers { get; }
Property Value
Type |
---|
GridCellRendererCollection |
FilterRowPosition
Gets or sets the position of the FilterRow in the SfDataGrid.
Declaration
[Cloneable(true)]
public RowPosition FilterRowPosition { get; set; }
Property Value
Type |
---|
RowPosition |
FooterColumnCount
Gets or sets the number of non-scrolling columns at the right side of SfDataGrid.
Declaration
[Cloneable(true)]
public int FooterColumnCount { get; set; }
Property Value
Type |
---|
System.Int32 |
FooterRowCount
Gets or sets the number of non-scrolling rows at the bottom of SfDataGrid.
Declaration
[Cloneable(true)]
public int FooterRowCount { get; set; }
Property Value
Type |
---|
System.Int32 |
FrozenColumnCount
Gets or sets the number of non-scrolling columns at the left side of SFDataGrid.
Declaration
[Cloneable(true)]
public int FrozenColumnCount { get; set; }
Property Value
Type |
---|
System.Int32 |
FrozenRowCount
Gets or sets the number of non-scrolling rows at the top of SFDataGrid.
Declaration
[Cloneable(true)]
public int FrozenRowCount { get; set; }
Property Value
Type |
---|
System.Int32 |
GridModel
Gets or sets the reference indicating whether the GridModel instance which manages interaction between SFDataGrid and ICollectionViewAdv.
Declaration
[Cloneable(false)]
protected GridModel GridModel { get; set; }
Property Value
Type | Description |
---|---|
GridModel | The reference to the GridModel instance. |
GroupCaptionContextMenu
Gets or sets the context menu that appears on the group caption of DataGrid.
Declaration
[Cloneable(true)]
public ContextMenuStrip GroupCaptionContextMenu { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ContextMenuStrip |
GroupCaptionTextFormat
Gets or sets the format of group caption text.
Declaration
[Cloneable(true)]
public string GroupCaptionTextFormat { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string that represents the format of group caption text.The default value is null. |
GroupColumnDescriptions
Gets or sets the collection of GroupColumnDescription object that describes how the column(s) to be grouped in the view.
Declaration
[Cloneable(true)]
public GroupColumnDescriptions GroupColumnDescriptions { get; set; }
Property Value
Type | Description |
---|---|
GroupColumnDescriptions | The collection of GroupColumnDescription object. The default value is null. |
Examples
this.sfDataGrid1.GroupColumnDescriptions.Add(new GroupColumnDescription() { ColumnName = "OrderID" });
this.sfDataGrid1.GroupColumnDescriptions.Add(new GroupColumnDescription() { ColumnName = "CustomerID" });
GroupDropAreaContextMenu
Gets or sets the context menu that appears on the GroupDropArea of the DataGrid.
Declaration
[Cloneable(true)]
public ContextMenuStrip GroupDropAreaContextMenu { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ContextMenuStrip |
GroupDropAreaItemContextMenu
Gets or sets the context menu that appears on the group drop item of the GroupDropArea.
Declaration
[Cloneable(true)]
public ContextMenuStrip GroupDropAreaItemContextMenu { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ContextMenuStrip |
GroupPanel
Gets or sets the GroupPanel for display the grouped columns.
Declaration
[Cloneable(false)]
public GroupPanel GroupPanel { get; set; }
Property Value
Type |
---|
GroupPanel |
GroupSummaryContextMenu
Gets or sets the context menu that appears on the group summary of DataGrid.
Declaration
[Cloneable(true)]
public ContextMenuStrip GroupSummaryContextMenu { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ContextMenuStrip |
GroupSummaryRows
Gets or sets the group summary rows.
Declaration
[Cloneable(true)]
public ObservableCollection<GridSummaryRow> GroupSummaryRows { get; set; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<GridSummaryRow> |
HeaderRowHeight
Gets or sets the height for the column header row.
Declaration
[Cloneable(true)]
public int HeaderRowHeight { get; set; }
Property Value
Type |
---|
System.Int32 |
HideEmptyGridViewDefinition
Gets or sets a value indicating whether to hide the empty GridViewDefinition.
Declaration
[Cloneable(true)]
public bool HideEmptyGridViewDefinition { get; set; }
Property Value
Type |
---|
System.Boolean |
IndentColumnWidth
Gets or sets the indent column width.
Declaration
[Cloneable(true)]
public double IndentColumnWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The width of indent column. |
Remarks
Grouping can be enabled by setting GroupColumnDescriptions of SFDataGrid.
IsDynamicDataSource
Gets or sets a value indicating whether the underlying data object type is dynamic.
Declaration
[Cloneable(true)]
public bool IsDynamicDataSource { get; set; }
Property Value
Type |
---|
System.Boolean |
IsListenerSuspended
Gets a value indicating whether the listener is suspended.
Declaration
[Cloneable(false)]
public bool IsListenerSuspended { get; }
Property Value
Type |
---|
System.Boolean |
LiveDataUpdateMode
Gets or sets a value to control data manipulation operations during data updates.
Declaration
[Cloneable(true)]
public LiveDataUpdateMode LiveDataUpdateMode { get; set; }
Property Value
Type | Description |
---|---|
LiveDataUpdateMode | One of the LiveDataUpdateMode that indicates how data manipulation operations are handled during data updates. The default value is Default. |
NavigationMode
Gets or sets a value indicating the navigation type of the grid.
Declaration
[Cloneable(true)]
public NavigationMode NavigationMode { get; set; }
Property Value
Type |
---|
NavigationMode |
NewItemPlaceholderPosition
Gets or sets a value that indicates the position of new record which is added using AddNewRow.
Declaration
[Cloneable(true)]
public NewItemPlaceholderPosition NewItemPlaceholderPosition { get; set; }
Property Value
Type | Description |
---|---|
NewItemPlaceholderPosition | One of the |
Remarks
This
NotificationSubscriptionMode
Gets or sets the value that indicates whether to listen
System.ComponentModel.INotifyPropertyChanging.PropertyChanging and
System.ComponentModel.INotifyPropertyChanged.PropertyChanged events of data object and
System.Collections.Specialized.INotifyCollectionChanged.CollectionChanged event of
Declaration
[Cloneable(true)]
public NotificationSubscriptionMode NotificationSubscriptionMode { get; set; }
Property Value
Type |
---|
NotificationSubscriptionMode |
Remarks
By default, view listens to System.ComponentModel.INotifyPropertyChanging.PropertyChanging and
System.ComponentModel.INotifyPropertyChanged.PropertyChanged events of data object and
System.Collections.Specialized.INotifyCollectionChanged.CollectionChanged event of
NotifyEventsToParentDataGrid
Gets or sets a value indicating whether to notify DetailsViewDataGrid to parent DataGrid.
Declaration
[Cloneable(true)]
public bool NotifyEventsToParentDataGrid { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
Events of all child DataGrid can be listened from parent DataGrid.
NotifyListener
Gets the listener to notify the details view changes.
Declaration
[Cloneable(false)]
public IDetailsViewNotifyListener NotifyListener { get; }
Property Value
Type |
---|
IDetailsViewNotifyListener |
PasteOption
Gets or sets a value that indicates whether how the clipboard value is pasted into SfDataGrid.
Declaration
[Cloneable(true)]
public PasteOptions PasteOption { get; set; }
Property Value
Type | Description |
---|---|
PasteOptions | The default value is |
Remarks
You can customize or cancel the paste operations through
PreviewRowHeight
Gets or sets the default height of the preview row.
Declaration
[Cloneable(true)]
public int PreviewRowHeight { get; set; }
Property Value
Type |
---|
System.Int32 |
PreviewRowHeightMode
Gets or sets the height calculation mode of the preview row.
Declaration
[Cloneable(true)]
public PreviewRowHeightMode PreviewRowHeightMode { get; set; }
Property Value
Type |
---|
PreviewRowHeightMode |
PreviewRowMappingName
Gets or sets the mapping name for the preview row.
Declaration
[Cloneable(true)]
public string PreviewRowMappingName { get; set; }
Property Value
Type |
---|
System.String |
PreviewRowPadding
Gets or sets the padding for the preview row.
Declaration
[Cloneable(true)]
public Padding PreviewRowPadding { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Padding |
RecordContextMenu
Gets or sets the context menu that appears on each record cells.
Declaration
[Cloneable(true)]
public ContextMenuStrip RecordContextMenu { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ContextMenuStrip |
RightToLeft
Gets or sets the RTL mode of the grid.
Declaration
[Cloneable(true)]
public override RightToLeft RightToLeft { get; set; }
Property Value
Type |
---|
System.Windows.Forms.RightToLeft |
RowCount
Gets the row count for the SFDataGrid.
Declaration
[Cloneable(false)]
public int RowCount { get; }
Property Value
Type |
---|
System.Int32 |
RowHeaderContextMenu
Gets or sets the context menu that appears on each row header cells.
Declaration
[Cloneable(true)]
public ContextMenuStrip RowHeaderContextMenu { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ContextMenuStrip |
RowHeaderWidth
Gets or sets a value indicates the width of the row header.
Declaration
[Cloneable(true)]
public double RowHeaderWidth { get; set; }
Property Value
Type |
---|
System.Double |
RowHeight
Gets or sets the height for the records row.
Declaration
[Cloneable(true)]
public int RowHeight { get; set; }
Property Value
Type |
---|
System.Int32 |
SearchController
Gets or sets an instance of the SearchController which controls the search operation in SfDataGrid.
Declaration
[Cloneable(false)]
public SearchController SearchController { get; set; }
Property Value
Type |
---|
SearchController |
SelectedDetailsViewGrid
Gets the selected DetailsView DataGrid.
Declaration
[Cloneable(true)]
public SfDataGrid SelectedDetailsViewGrid { get; }
Property Value
Type |
---|
SfDataGrid |
SelectedIndex
Gets or sets the index of corresponding selected row.
Declaration
[Cloneable(false)]
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the selected item. The default value is -1. |
SelectedItem
Gets or sets the data item bound to the row that contains the current cell.
Declaration
[Cloneable(false)]
public object SelectedItem { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The object that is the currently selected item or null if there is no currently selected item. |
SelectedItems
Gets or sets the collection of objects that contains data item of corresponding to the selected records in a SFDataGrid.
Declaration
[Cloneable(false)]
public ObservableCollection<object> SelectedItems { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<System.Object> | The collection of objects that contains data item corresponding to the selected rows. |
SelectedNodeEntries
Gets the collection of node entries. It contains the node entry of selected rows other than records (CaptionSummaryRow, GroupSummaryRow, GroupCaptionRow)
Declaration
[Cloneable(false)]
public ObservableCollection<SelectedRowInfo> SelectedNodeEntries { get; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<SelectedRowInfo> |
SelectionController
Gets or sets an instance of
Declaration
[Cloneable(false)]
public SelectionControllerBase SelectionController { get; set; }
Property Value
Type | Description |
---|---|
SelectionControllerBase | An instance of |
Remarks
If you want to customize the selection controller, you can override the
SelectionMode
Gets or sets the value that indicates how the rows can be selected in SfDataGrid.
Declaration
[Cloneable(true)]
public GridSelectionMode SelectionMode { get; set; }
Property Value
Type | Description |
---|---|
GridSelectionMode | One of the |
SelectionUnit
Gets or sets a value indicating the Selection type of the grid.
Declaration
[Cloneable(true)]
public SelectionUnit SelectionUnit { get; set; }
Property Value
Type |
---|
SelectionUnit |
SerializationController
Gets or sets an instance of
Declaration
[Cloneable(true)]
public SerializationController SerializationController { get; set; }
Property Value
Type | Description |
---|---|
SerializationController | An instance of |
Remarks
ShowBusyIndicator
Gets or sets a value indicating whether the busy indicator needs to be shown for the SfDataGrid operations.
Declaration
public bool ShowBusyIndicator { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowErrorIcon
Gets or sets a value indicating whether the error icon should be drawn for the validation error cells.
Declaration
[Cloneable(true)]
public bool ShowErrorIcon { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowGroupDropArea
Gets or sets a value indicating whether the
Declaration
[Cloneable(true)]
public bool ShowGroupDropArea { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the group drop area is enabled in SFDataGrid; otherwise, false. The default value is false. |
ShowHeaderToolTip
Gets or sets a value indicating whether the tooltip should be displayed when mouse hovered on the header cells of the grid.
Declaration
[Cloneable(true)]
public bool ShowHeaderToolTip { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowPreviewRow
Gets or sets a value indicating whether to include/exclude the preview rows to the SfDataGrid.
Declaration
[Cloneable(true)]
public bool ShowPreviewRow { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowRowHeader
Gets or sets a value indicating whether row headers should be displayed or not.
Declaration
[Cloneable(true)]
public bool ShowRowHeader { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowRowHeaderErrorIcon
Gets or sets a value indicating whether the error icon should be drawn for the row header cells.
Declaration
[Cloneable(true)]
public bool ShowRowHeaderErrorIcon { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowSortNumbers
Gets or sets a value indicating whether the sequence number should be displayed on the header cell of sorted column during multi-column sorting.
Declaration
[Cloneable(true)]
public bool ShowSortNumbers { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the sequence number is displayed on the header cell of sorted column ; otherwise,false.The default value is false . |
Remarks
The multi-column sorting can be applied by pressing CTRL key and the corresponding sequence number is displayed on its header cell of the column simultaneously.
ShowToolTip
Gets or sets a value indicating whether the tooltip should be displayed when mouse hovered on the cells of the grid.
Declaration
[Cloneable(true)]
public bool ShowToolTip { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowValidationErrorToolTip
Gets or sets a value indicating whether the validation error tooltip should be displayed when hovered on the error icons.
Declaration
[Cloneable(true)]
public bool ShowValidationErrorToolTip { get; set; }
Property Value
Type |
---|
System.Boolean |
SortClickAction
Gets or sets a value that indicates whether single or double-click by the user should initiate the data sort.
Declaration
[Cloneable(true)]
public SortClickAction SortClickAction { get; set; }
Property Value
Type | Description |
---|---|
SortClickAction | One of the SortClickAction enumeration that specifies the sort click action. The default value is SortClickAction.SingleClick. |
SortColumnDescriptions
Gets or sets the collection of SortColumnDescription objects to sort the data programmatically.
Declaration
[Cloneable(true)]
public SortColumnDescriptions SortColumnDescriptions { get; set; }
Property Value
Type | Description |
---|---|
SortColumnDescriptions | The collection of SortColumnDescription object to sort the data programmatically.The default value is null. |
Examples
this.sfDataGrid1.SortColumnDescriptions.Add(new SortColumnDescription() { ColumnName = "OrderID", SortDirection = ListSortDirection.Ascending });
this.sfDataGrid1.SortColumnDescriptions.Add(new SortColumnDescription() { ColumnName = "CustomerName", SortDirection = ListSortDirection.Descending });
SortComparers
Gets or sets a collection indicating whether the of comparer's to sort the data based on custom logic .
Declaration
[Cloneable(true)]
public SortComparers SortComparers { get; set; }
Property Value
Type |
---|
SortComparers |
Remarks
A comparer that are added to SortComparers collection to apply custom Sorting based on the specified column name and sort direction.
SourceType
Gets or sets the type of data object displayed in SFDataGrid.
Declaration
[Cloneable(true)]
public Type SourceType { get; set; }
Property Value
Type |
---|
System.Type |
Remarks
Used to specify the type of data object for column population and data (sorting,grouping and filtering) when your data object have multilevel inheritance.
StackedHeaderRows
Gets or sets the collection ofStackedHeaderRow objects that declares StackedHeadeRows. StackedHeaders allow you to display headers that spread multiple columns before the regular column headers.
Declaration
[Cloneable(true)]
public StackedHeaderRows StackedHeaderRows { get; set; }
Property Value
Type |
---|
StackedHeaderRows |
Style
Gets or sets the style for the SfDataGrid elements.
Declaration
[Cloneable(true)]
public DataGridStyle Style { get; set; }
Property Value
Type |
---|
DataGridStyle |
SummaryCalculationMode
Gets or sets the summary calculation mode for the caption and group summaries.
Declaration
[Cloneable(true)]
public CalculationMode SummaryCalculationMode { get; set; }
Property Value
Type |
---|
CalculationMode |
SummaryCalculationUnit
Gets or sets the value that specifies the mode for calculating summaries which decides whether to calculate summary for all records or selected records.
Declaration
[Cloneable(true)]
public SummaryCalculationUnit SummaryCalculationUnit { get; set; }
Property Value
Type |
---|
SummaryCalculationUnit |
TableControl
Gets or sets the TableControl for display the ItemsSource.
Declaration
[Cloneable(false)]
public TableControl TableControl { get; set; }
Property Value
Type |
---|
TableControl |
TableSummaryContextMenu
Gets or sets the context menu that appears on table summary of DataGrid.
Declaration
[Cloneable(true)]
public ContextMenuStrip TableSummaryContextMenu { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ContextMenuStrip |
TableSummaryRows
Gets or sets the collection of GridSummaryRow that displays the summary information either at top or bottom of SFDataGrid.
Declaration
[Cloneable(true)]
public ObservableCollection<GridTableSummaryRow> TableSummaryRows { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<GridTableSummaryRow> | The collection of GridSummaryRow to display the summary information either at top or bottom of SFDataGrid. The default value is null. |
Remarks
The table summary can have more than one summary rows and the summary value calculated overall the records in SFDataGrid.
TabStop
Gets or sets a value indicating whether the user can give the focus to this control using the TAB key.
Declaration
public bool TabStop { get; set; }
Property Value
Type |
---|
System.Boolean |
ToolTipOption
Gets or sets the options for the tooltip to be displayed when hovering on the cell.
Declaration
[Cloneable(true)]
public ToolTipOptions ToolTipOption { get; set; }
Property Value
Type |
---|
ToolTipOptions |
UnboundRowCellRenderers
Gets the reference to the GridCellRendererCollection instance which holds the renderer's for UnboundRow Cell.
Declaration
[Cloneable(false)]
public GridCellRendererCollection UnboundRowCellRenderers { get; }
Property Value
Type |
---|
GridCellRendererCollection |
Examples
The following example shows how to add the custom unbound row cell renderer.
//Add the customized unbound cell renderer.
sfDataGrid1.UnboundRowCellRenderers.Add("DateTimePicker", new DatePickerRenderer());
///
UnboundRows
Gets or sets the collection of GridUnboundRow which denotes the count and position of additional rows at top and bottom of SfDataGrid. These additional rows are not bound to data source of SfDataGrid.
Declaration
[Cloneable(true)]
public UnboundRows UnboundRows { get; set; }
Property Value
Type | Description |
---|---|
UnboundRows | The collection of GridUnboundRow to add additional rows to display the custom information in SfDataGrid. The default value is null. |
Remarks
Populate unbound rows data by handling QueryUnboundRowInfo event.
UsePLINQ
Gets or sets a value indicating whether to enable Parallel LINQ while sorting, filtering, grouping and summary calculation to improve performance.
Declaration
[Cloneable(true)]
public bool UsePLINQ { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the Parallel LINQ is enabled; otherwise,false. The default value is false. |
ValidationErrorToolTip
Gets or sets the options for the validation error tooltip to be displayed when hovering on the error icons.
Declaration
[Cloneable(true)]
public ValidationErrorToolTipOptions ValidationErrorToolTip { get; set; }
Property Value
Type |
---|
ValidationErrorToolTipOptions |
ValidationMode
Gets or sets a value indicating the validation mode of the grid.
Declaration
[Cloneable(true)]
public GridValidationMode ValidationMode { get; set; }
Property Value
Type |
---|
GridValidationMode |
View
Gets the reference to the ICollectionViewAdv instance which manage the records, sorting, grouping, summaries and filtering in SFDataGrid.
Declaration
[Cloneable(false)]
public ICollectionViewAdv View { get; }
Property Value
Type |
---|
ICollectionViewAdv |
Remarks
View will be created based on ItemsSource you are setting. Below are the list of CollectionViews available in SFDataGrid.
Methods
BeginInit()
Signals the object that initialization is starting.
Declaration
public void BeginInit()
BeginUpdate()
Suspends the painting of the control until the EndUpdate() method is called.
Declaration
public void BeginUpdate()
CanQueryUnboundRow()
Checks whether the QueryUnboundRowInfo event is wired or not.
Declaration
public bool CanQueryUnboundRow()
Returns
Type | Description |
---|---|
System.Boolean | Returns true, If the QueryUnboundRowInfo event is wired; Otherwise return false. |
ClearFilter(GridColumn)
Clears filters for the particular column.
Declaration
public void ClearFilter(GridColumn column)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | The column that needs to clear the filters. |
ClearFilter(String)
Clears filters for the particular column.
Declaration
public void ClearFilter(string columnName)
Parameters
Type | Name | Description |
---|---|---|
System.String | columnName | The MappingName of the column that needs to clear the filters. |
ClearFilters()
Clears filters for all the columns in SFDataGrid.
Declaration
public void ClearFilters()
ClearGrouping()
Clears grouping for all the columns in SFDataGrid.
Declaration
public void ClearGrouping()
Remarks
This method will clear the grouping programmatically .
ClearSelection()
Clears all the selection in SFDataGrid.
Declaration
public void ClearSelection()
ClearSorting()
Clears sorting for all the columns in SFDataGrid
Declaration
public void ClearSorting()
Remarks
This method will clear the sorting programmatically .
CollapseAllDetailsView()
Collapses all the details view of the grid.
Declaration
public void CollapseAllDetailsView()
CollapseAllGroup()
Collapses all the groups in SFDataGrid.
Declaration
public void CollapseAllGroup()
Remarks
This method collapse all the groups in SFDataGrid programmatically.
CollapseAllPreviewRow()
Collapses all the preview rows of the grid.
Declaration
public void CollapseAllPreviewRow()
CollapseDetailsViewAt(Int32)
Collapses the DetailsView at the record index.
Declaration
public void CollapseDetailsViewAt(int recordIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | recordIndex | The record index of the details view to be collapsed. |
CollapseGroup(Group)
Collapses the specified Group.
Declaration
public void CollapseGroup(Group group)
Parameters
Type | Name | Description |
---|---|---|
Group | group | Specifies the group to collapse it from view. |
Examples
var group = dataGrid.View.TopLevel.Groups[0] as Group;
this.dataGrid.CollapseGroup(group);
CollapseGroupsAtLevel(Int32)
Collapse all the groups at the given level.
Declaration
public void CollapseGroupsAtLevel(int groupLevel)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | groupLevel | Specifies the group level to collapse the group. |
Examples
this.dataGrid.CollapseGroupsAtLevel(2);
CollapsePreviewRowAt(Int32)
Collapses the preview row at the given record index.
Declaration
public void CollapsePreviewRowAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The record index which needs to be collapsed. |
CreateAccessibilityInstance()
Overridden to update the custom accessibility object for the SfDataGrid.
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
Type | Description |
---|---|
System.Windows.Forms.AccessibleObject | Returns the accessibility object of the SfDataGrid. |
DeleteSelectedRecords()
Deletes the selected record rows from SfDataGrid.
Declaration
public void DeleteSelectedRecords()
Remarks
The selected record rows only deleted(other Unbound rows, AddNewRow, Caption rows and filter row are not deleted) when pressing the delete key. And the record are deleted only when current cell in record rows. And the SelectedItems must be greater than zero.
Deserialize(Stream)
Deserializes the SfDataGrid based on the XML document contained by the specified Stream.
Declaration
public void Deserialize(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Specifies the XML document to deserialize. |
Deserialize(Stream, DeserializationOptions)
Deserializes the SfDataGrid based on the XML document of the specified Stream with
Declaration
public void Deserialize(Stream stream, DeserializationOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Contains the XML document to deserialize. |
DeserializationOptions | options | Decides the type of operations such as sorting ,filtering ,and etc to be deserialized. |
Dispose(Boolean)
Releases the unmanaged resources used by the Control and its child controls and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
DisposeViewOnItemsSourceChanged()
Disposes the view on the collection changed.
Declaration
protected virtual void DisposeViewOnItemsSourceChanged()
EndInit()
Signals the object that initialization is complete.
Declaration
public void EndInit()
EndUpdate()
Resumes the painting of the control suspended by calling the BeginUpdate() method.
Declaration
public void EndUpdate()
ExpandAllDetailsView()
Expands all the details view of the grid.
Declaration
public void ExpandAllDetailsView()
ExpandAllGroup()
Expands all the groups in SFDataGrid.
Declaration
public void ExpandAllGroup()
Remarks
This method expand all the groups in SFDataGrid programmatically.
ExpandAllPreviewRow()
Expands all the preview rows of the grid.
Declaration
public void ExpandAllPreviewRow()
ExpandDetailsViewAt(Int32)
Expands the DetailsView at the record index.
Declaration
public void ExpandDetailsViewAt(int recordIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | recordIndex | The index of the DetailsView to be expanded. |
ExpandGroup(Group)
Expands the specified group.
Declaration
public void ExpandGroup(Group group)
Parameters
Type | Name | Description |
---|---|---|
Group | group | Specifies the group to expand it from view. |
Examples
var group = dataGrid.View.TopLevel.Groups[0] as Group;
this.dataGrid.ExpandGroup(group);
ExpandGroupsAtLevel(Int32)
Expands the group based on its level.
Declaration
public void ExpandGroupsAtLevel(int groupLevel)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | groupLevel | Specifies the group level to expand the group. |
Examples
this.dataGrid.ExpandGroupsAtLevel(2);
ExpandPreviewRowAt(Int32)
Expands the preview row at the given record index.
Declaration
public void ExpandPreviewRowAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The record index which needs to be expand. |
GetCellRenderer(GridColumn)
Gets the cell renderer of the column.
Declaration
public GridCellRendererBase GetCellRenderer(GridColumn column)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | The GridColumn. |
Returns
Type | Description |
---|---|
GridCellRendererBase | Returns the cell renderer of the column. |
GetControlName(String)
Helps to apply the ControlName settings in control
Declaration
public override string GetControlName(string controlName)
Parameters
Type | Name | Description |
---|---|---|
System.String | controlName | The name of the control |
Returns
Type | Description |
---|---|
System.String | Returns the control name. |
Overrides
GetModified()
Checks whether the control properties is modified or not .
Declaration
public virtual bool GetModified()
Returns
Type | Description |
---|---|
System.Boolean | Return true when the default value of the properties are modified other wise return false. |
GetSelectedCells()
Gets the collection of selected cells in SfDataGrid.
Declaration
public List<SelectedCellInfo> GetSelectedCells()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<SelectedCellInfo> | Returns the collection of |
Remarks
Selected cells cannot be retrieved when SelectionUnit is Row.
GetUnboundCellValue(GridColumn, Object)
Gets the cell value to populate the UnboundColumn by evaluating the expression or Format with the record.
Declaration
public object GetUnboundCellValue(GridColumn column, object record)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | Specifies the corresponding column to get the cell value. |
System.Object | record | Specifies the corresponding record to get the cell value. |
Returns
Type | Description |
---|---|
System.Object | Returns the cell value of the specified column based on Expression or Format with record. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the GridUnboundColumn is defined with Expression for DataTable . |
InvalidateRowHeight(Int32)
Invalidates the row height for the given row index.
Declaration
public void InvalidateRowHeight(int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index that needs to be invalidated. |
InValidateUnboundRow(GridUnboundRow, Boolean)
Invalidates the unbound row to refresh the data in View.
Declaration
public void InValidateUnboundRow(GridUnboundRow unboundRow, bool canInvalidateColumn = true)
Parameters
Type | Name | Description |
---|---|---|
GridUnboundRow | unboundRow | Specifies the GridUnboundRow to be invalidated. |
System.Boolean | canInvalidateColumn | Specifies to whether to in invalidate columns or not. |
MoveToCurrentCell(RowColumnIndex)
Moves the current cell for the specified rowColumnIndex.
Declaration
public void MoveToCurrentCell(RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | rowColumnIndex | Specifies the corresponding rowColumnIndex to move the current cell. |
OnDataSourceChanged(Object, Object)
Occurs when DataSource is changed.
Declaration
protected virtual void OnDataSourceChanged(object oldValue, object newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Object | oldValue | The old value of the DataSource. |
System.Object | newValue | The new value of the DataSource. |
OnThemeNameChanged(String)
Helps to apply the ThemeName settings in control
Declaration
public override void OnThemeNameChanged(string themeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | themeName | The ThemeName of the Control |
Overrides
OnValidating(CancelEventArgs)
Occurs while the control is validating.
Declaration
protected override void OnValidating(CancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.CancelEventArgs | e | The System.ComponentModel.CancelEventArgs that contains event data. |
RaiseQueryUnboundRowInfo(GridUnboundRow, UnboundActions, Object, GridColumn, String, RowColumnIndex)
Raises the QueryUnboundRowInfo event in SfDataGrid.
Declaration
public QueryUnboundRowInfoArgs RaiseQueryUnboundRowInfo(GridUnboundRow gridUnboundRow, UnboundActions action, object value, GridColumn column, string cellType, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
GridUnboundRow | gridUnboundRow | The unbound row details. |
UnboundActions | action | Specifies the type of UnboundActions to be performed in GridUnboundRow. |
System.Object | value | Specifies the value changes of GridUnboundRow. |
GridColumn | column | Specifies the corresponding column . |
System.String | cellType | Specifies the cellType of the column. |
RowColumnIndex | rowColumnIndex | Specifies the corresponding rowColumnIndex. |
Returns
Type | Description |
---|---|
QueryUnboundRowInfoArgs | Returns the QueryUnboundRowInfoArgs that contains data for QueryUnboundRowInfo event. |
RaiseThemeChanged(Object, ThemeChangedEventArgs)
Raises the ThemeNameChanged and ThemeChanged event when theme name changed.
Declaration
protected override void RaiseThemeChanged(object sender, ThemeChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender value. |
ThemeChangedEventArgs | args | A ThemeChangedEventArgs contains the event data. |
Overrides
ResetTableControl()
Resets the TableControl back to its default value.
Declaration
public void ResetTableControl()
ResumeNotifyListener()
Resumes the listener to notify the changes.
Declaration
public void ResumeNotifyListener()
SelectAll()
Selects all the rows (Records, CaptionRow, GroupSummaryRow) in the SFDataGrid.
Declaration
public void SelectAll()
SelectCell(Object, GridColumn)
Selects the cell that matches the given row data and the grid column.
Declaration
public void SelectCell(object rowData, GridColumn gridColumn)
Parameters
Type | Name | Description |
---|---|---|
System.Object | rowData | The row data of the cell to be selected. |
GridColumn | gridColumn | The grid column of the cell to be selected. |
SelectCells(Object, GridColumn, Object, GridColumn)
Selects the cells that matches in the given range of rows and columns.
Declaration
public void SelectCells(object startRowData, GridColumn startColumn, object endRowData, GridColumn endColumn)
Parameters
Type | Name | Description |
---|---|---|
System.Object | startRowData | The start row data to be selected. |
GridColumn | startColumn | The start column of the cell to be selected. |
System.Object | endRowData | The end row data to be selected. |
GridColumn | endColumn | The end column of the cell to be selected. |
SelectRows(Int32, Int32)
Selects the rows based on the specified the start and end row index.
Declaration
public void SelectRows(int startRowIndex, int endRowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startRowIndex | Specifies the start index of the row to select. |
System.Int32 | endRowIndex | Specifies the end index of the row to select. |
Remarks
This is applicable only for Multiple and Extended selection mode.
Serialize(Stream)
Serializes the SfDataGrid control to the XML document file that are stored in the specified Stream.
Declaration
public void Serialize(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Specifies the stream used to write the XML document file. |
Serialize(Stream, SerializationOptions)
Serializes the SfDataGrid with
Declaration
public void Serialize(Stream stream, SerializationOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Specifies stream used to write XML document file. |
SerializationOptions | options | Specifies the |
SetCurrentCellValidated(Boolean)
Sets the cell validated state for GridCheckBoxColumn.
Declaration
public void SetCurrentCellValidated(bool isCellValidated)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isCellValidated | The value that indicates whether the cell is validated or not. |
SetCurrentRowValidated(Boolean)
Sets the row validated state for GridCheckBoxColumn.
Declaration
public void SetCurrentRowValidated(bool isRowValidated)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isRowValidated | The value that indicates whether the row is validated or not. |
SetNotifierListener(IDetailsViewNotifyListener)
Sets the notify listener to notify the details view changes.
Declaration
public void SetNotifierListener(IDetailsViewNotifyListener notifyListener)
Parameters
Type | Name | Description |
---|---|---|
IDetailsViewNotifyListener | notifyListener | The notify listener. |
SuspendNotifyListener()
Suspends the listener from notifying the changes.
Declaration
public void SuspendNotifyListener()
UnselectCell(Object, GridColumn)
Unselects the cell that matches the given row data and the grid column.
Declaration
public void UnselectCell(object rowData, GridColumn gridColumn)
Parameters
Type | Name | Description |
---|---|---|
System.Object | rowData | The row data of the cell to be unselected. |
GridColumn | gridColumn | The grid column of the cell to be unselected. |
UnselectCells(Object, GridColumn, Object, GridColumn)
Unselects the cells that matches in the given range of rows and columns.
Declaration
public void UnselectCells(object startRowData, GridColumn startColumn, object endRowData, GridColumn endColumn)
Parameters
Type | Name | Description |
---|---|---|
System.Object | startRowData | The start row data to be unselected. |
GridColumn | startColumn | The start column of the cell to be unselected. |
System.Object | endRowData | The end row data to be unselected. |
GridColumn | endColumn | The end column of the cell to be unselected. |
UnWireEvents()
UnWires the events of the GridModel.
Declaration
protected virtual void UnWireEvents()
WireEvents()
Wires the events of the GridModel.
Declaration
protected virtual void WireEvents()
WndProc(ref Message)
Processes Windows messages.
Declaration
protected override void WndProc(ref Message m)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | m | The Windows System.Windows.Forms.Message to process. |
Events
AddNewRowInitiating
Occurs when the AddNewRow is being initiated.
Declaration
public event AddNewRowInitiatingEventHandler AddNewRowInitiating
Event Type
Type |
---|
AddNewRowInitiatingEventHandler |
Remarks
You can set the default value for the AddNewRow is being initiated through the
Examples
The following example shows how to handle the AddNewRowInitiating event
sfDataGrid1.AddNewRowInitiating += sfDataGrid1_AddNewRowInitiating;
void sfDataGrid1_AddNewRowInitiating(object sender, AddNewRowInitiatingEventArgs e)
{
var data = e.NewObject as OrderInfo;
data.OrderID = 11;
data.CustomerID = "10001";
data.ContactNumber = 190232;
data.ProductName = "Butter";
}
AutoGeneratingColumn
Occurs when column is generated for the properties in underlying data object.
Declaration
public event AutoGeneratingColumnEventHandler AutoGeneratingColumn
Event Type
Type |
---|
AutoGeneratingColumnEventHandler |
Remarks
You can cancel or customize the column being created using the AutoGeneratingColumnArgs event argument.
AutoGeneratingRelations
Occurs when a relation for the Master-Details view is generated automatically.
Declaration
public event AutoGeneratingRelationsEventHandler AutoGeneratingRelations
Event Type
Type |
---|
AutoGeneratingRelationsEventHandler |
BusyIndicatorShowing
Occurs while showing the busy indicator for the SfDataGrid.
Declaration
public event BusyIndicatorShowingEventHandler BusyIndicatorShowing
Event Type
Type |
---|
BusyIndicatorShowingEventHandler |
CellButtonClick
Occurs when the button click is performed on the cell.
Declaration
public event CellButtonClickEventHandler CellButtonClick
Event Type
Type |
---|
CellButtonClickEventHandler |
CellCheckBoxClick
Occurs when the check box of the cell is clicked.
Declaration
public event CellCheckBoxClickEventHandler CellCheckBoxClick
Event Type
Type |
---|
CellCheckBoxClickEventHandler |
Remarks
You can handle or customize the state of the each cell with
Examples
The following example shows how to cancel the CellCheckBoxClick event.
this.sfDataGrid1.CheckBoxClicked += SfDataGrid1_CheckBoxClicked;
private void SfDataGrid1_CheckBoxClicked(object sender, CellCheckBoxClickEventArgs e)
{
if (e.Column.MappingName == "Status" && e.NewState == CheckState.Indeterminate)
e.Cancel = true;
}
The following example shows how to change the new state of the cell using CellCheckBoxClick event.
this.sfDataGrid1.CheckBoxClicked += SfDataGrid1_CheckBoxClicked;
private void SfDataGrid1_CheckBoxClicked(object sender, CellCheckBoxClickEventArgs e)
{
if (e.Column.MappingName == "Status" && e.NewState == CheckState.Indeterminate)
e.NewState = CheckState.Checked;
}
CellClick
Occurs when click on the cell.
Declaration
public event CellClickEventHandler CellClick
Event Type
Type |
---|
CellClickEventHandler |
CellComboBoxSelectionChanged
Occurs when the selection in ComboBox drop down is changed.
Declaration
public event EventHandler<CellComboBoxSelectionChangedEventArgs> CellComboBoxSelectionChanged
Event Type
Type |
---|
System.EventHandler<CellComboBoxSelectionChangedEventArgs> |
CellDoubleClick
Occurs when double click on the cell.
Declaration
public event CellClickEventHandler CellDoubleClick
Event Type
Type |
---|
CellClickEventHandler |
ColumnDragging
Occurs when the column is being reordered in to a new position.
Declaration
public event ColumnDraggingEventHandler ColumnDragging
Event Type
Type |
---|
ColumnDraggingEventHandler |
Remarks
You can cancel or customize the column being created using the ColumnDraggingEventArgs event argument.
Examples
The following example shows how to handle the ColumnDragging event
sfDataGrid1.ColumnDragging += sfDataGrid1_QueryColumnDragging;
void sfDataGrid1_QueryColumnDragging(object sender, ColumnDraggingEventArgs e)
{
if (e.Reason == ColumnDraggingAction.Dragging)
{
if ((sender as SfDataGrid).Columns[e.FromColumnIndex].MappingName == "OrderID")
e.Cancel = true;
}
}
ColumnResizing
Occurs when the column is resizing through the resizing controller.
Declaration
public event ColumnResizingEventHandler ColumnResizing
Event Type
Type |
---|
ColumnResizingEventHandler |
ContextMenuOpened
Occurs when any context menu on the DataGrid is shown.
Declaration
public event ContextMenuOpenedEventHandler ContextMenuOpened
Event Type
Type |
---|
ContextMenuOpenedEventHandler |
ContextMenuOpening
Occurs when any context menu on the DataGrid is showing.
Declaration
public event ContextMenuOpeningEventHandler ContextMenuOpening
Event Type
Type |
---|
ContextMenuOpeningEventHandler |
CopyCellContent
Occurs when each cell in the selected cells or rows being copied from SfDataGrid into clipboard.
Declaration
public event CellCutCopyPasteEventHandler CopyCellContent
Event Type
Type |
---|
CellCutCopyPasteEventHandler |
Remarks
You can cancel or customize each cell is being copied from the selected cells or rows through
CopyContent
Occurs when the selected cells or rows in SfDataGrid is being copied in to clipboard.
Declaration
public event CutCopyPasteEventHandler CopyContent
Event Type
Type |
---|
CutCopyPasteEventHandler |
Remarks
You can cancel or customize the content being copied from a SfDataGrid through
CurrentCellActivated
Occurs after the current cell is activated.
Declaration
public event CurrentCellActivatedEventHandler CurrentCellActivated
Event Type
Type |
---|
CurrentCellActivatedEventHandler |
CurrentCellActivating
Occurs when the current cell is going to be activated.
Declaration
public event CurrentCellActivatingEventHandler CurrentCellActivating
Event Type
Type |
---|
CurrentCellActivatingEventHandler |
CurrentCellBeginEdit
Occurs when the current cell enters into edit mode.
Declaration
public event CurrentCellBeginEditEventHandler CurrentCellBeginEdit
Event Type
Type |
---|
CurrentCellBeginEditEventHandler |
CurrentCellEndEdit
Occurs when the current cell leaves the edit mode.
Declaration
public event CurrentCellEndEditEventHandler CurrentCellEndEdit
Event Type
Type |
---|
CurrentCellEndEditEventHandler |
CurrentCellKeyDown
Occurs when the CurrentCell KeyDown event is raised.
Declaration
public event CurrentCellKeyEventHandler CurrentCellKeyDown
Event Type
Type |
---|
CurrentCellKeyEventHandler |
CurrentCellKeyPress
Occurs when the CurrentCell KeyPress event is raised.
Declaration
public event CurrentCellKeyPressEventHandler CurrentCellKeyPress
Event Type
Type |
---|
CurrentCellKeyPressEventHandler |
CurrentCellKeyUp
Occurs when the CurrentCell KeyUp event is raised.
Declaration
public event CurrentCellKeyEventHandler CurrentCellKeyUp
Event Type
Type |
---|
CurrentCellKeyEventHandler |
CurrentCellValidated
Occurs after the current cell is validated.
Declaration
public event CurrentCellValidatedEventHandler CurrentCellValidated
Event Type
Type |
---|
CurrentCellValidatedEventHandler |
CurrentCellValidating
Occurs when the current cell is going to be validated.
Declaration
public event CurrentCellValidatingEventHandler CurrentCellValidating
Event Type
Type |
---|
CurrentCellValidatingEventHandler |
DataSourceChanged
Occurs when changed the data source of SfDataGrid.
Declaration
public event DataSourceChangedEventHandler DataSourceChanged
Event Type
Type |
---|
DataSourceChangedEventHandler |
DetailsViewCollapsed
Occurs when the DetailsViewDataGrid is collapsed.
Declaration
public event DetailsViewCollapsedEventHandler DetailsViewCollapsed
Event Type
Type |
---|
DetailsViewCollapsedEventHandler |
DetailsViewCollapsing
Occurs when the DetailsViewDataGrid is collapsing.
Declaration
public event DetailsViewCollapsingEventHandler DetailsViewCollapsing
Event Type
Type |
---|
DetailsViewCollapsingEventHandler |
DetailsViewExpanded
Occurs when the DetailsViewDataGrid is expanded.
Declaration
public event DetailsViewExpandedEventHandler DetailsViewExpanded
Event Type
Type |
---|
DetailsViewExpandedEventHandler |
DetailsViewExpanding
Occurs when the DetailsViewDataGrid is expanding.
Declaration
public event DetailsViewExpandingEventHandler DetailsViewExpanding
Event Type
Type |
---|
DetailsViewExpandingEventHandler |
DetailsViewLoading
Occurs when the DetailsViewDataGrid is loading.
Declaration
public event DetailsViewLoadingAndUnloadingEventHandler DetailsViewLoading
Event Type
Type |
---|
DetailsViewLoadingAndUnloadingEventHandler |
DetailsViewUnloading
Occurs when the DetailsViewDataGrid is unloading.
Declaration
public event DetailsViewLoadingAndUnloadingEventHandler DetailsViewUnloading
Event Type
Type |
---|
DetailsViewLoadingAndUnloadingEventHandler |
DrawCell
Occurs while drawing the cell.
Declaration
public event DrawCellEventHandler DrawCell
Event Type
Type |
---|
DrawCellEventHandler |
DrawFreezePaneLine
Occurs while drawing the freeze panes.
Declaration
public event DrawFreezePaneLineEventHandler DrawFreezePaneLine
Event Type
Type |
---|
DrawFreezePaneLineEventHandler |
DrawPreviewRow
Occurs while drawing the preview row.
Declaration
public event EventHandler<DrawPreviewRowEventArgs> DrawPreviewRow
Event Type
Type |
---|
System.EventHandler<DrawPreviewRowEventArgs> |
EditingControlShowing
Occurs when a control for editing a cell is showing
Declaration
public event EventHandler<DataGridEditingControlShowingEventArgs> EditingControlShowing
Event Type
Type |
---|
System.EventHandler<DataGridEditingControlShowingEventArgs> |
Remarks
You can handle this event to customize the appearance of the editing control when a cell enters edit mode.
To customize the appearance of the control, set the properties of the object returned by the
Examples
The following example show how to handle this event to change the
// Triggering the EditingControlShowing event.
this.sfDataGrid1.EditingControlShowing += SfDataGrid1_EditingControlShowing;
private void sfDataGrid1_ EditingControlShowing (object sender, EditingCosntrolShowingEventArgs e)
{
if (e.Column.MappingName == "ProductName")
{
// To apply styling for cell editor.
e.Style.BackColor = Color.Coral;
e.Style.TextColor = Color.White;
}
}
ExternalExceptionThrown
Occurs while using the merged cells with the selection.
Declaration
public event ExternalExceptionThrownEventHandler ExternalExceptionThrown
Event Type
Type |
---|
ExternalExceptionThrownEventHandler |
FilterChanged
Occurs after the column is filtered in SfDataGrid.
Declaration
public event FilterChangedEventHandler FilterChanged
Event Type
Type |
---|
FilterChangedEventHandler |
FilterChanging
Occurs when the column is being filter in SfDataGrid.
Declaration
public event FilterChangingEventHandler FilterChanging
Event Type
Type |
---|
FilterChangingEventHandler |
FilterPopupShowing
Occurs while showing the filter pop up for the column in SfDataGrid.
Declaration
public event FilterPopupShowingEventHandler FilterPopupShowing
Event Type
Type |
---|
FilterPopupShowingEventHandler |
FilterPopupShown
Occurs after the filter pop up is shown for the column in SfDataGrid.
Declaration
public event FilterPopupShownEventHandler FilterPopupShown
Event Type
Type |
---|
FilterPopupShownEventHandler |
GroupCollapsed
Occurs after the group is collapsed.
Declaration
public event GroupChangedEventHandler GroupCollapsed
Event Type
Type |
---|
GroupChangedEventHandler |
Remarks
This event occurs after the GroupCollapsing event if that event is not canceled and it will not raise when the group is collapsed programmatically.
GroupCollapsing
Occurs when the group is being collapsed.
Declaration
public event GroupChangingEventHandler GroupCollapsing
Event Type
Type |
---|
GroupChangingEventHandler |
Remarks
You can cancel or customize the group being collapsed through GroupChangingEventArgs event argument and it will not raise when the group is collapsed programmatically.
GroupExpanded
Occurs after the group is expanded.
Declaration
public event GroupChangedEventHandler GroupExpanded
Event Type
Type |
---|
GroupChangedEventHandler |
Remarks
This event occurs after the GroupExpanding event if that event is not canceled and it will not raised when the group is expanded programmatically.
GroupExpanding
Occurs when the group is being expanded.
Declaration
public event GroupChangingEventHandler GroupExpanding
Event Type
Type |
---|
GroupChangingEventHandler |
Remarks
You can cancel or customize the group being expanded through GroupChangingEventArgs event argument and it will not raised when the group is expanded programmatically.
HyperlinkOpened
Occurs when a link from a GridHyperlinkColumn is opened.
Declaration
public event CellHyperlinkOpenedEventHandler HyperlinkOpened
Event Type
Type |
---|
CellHyperlinkOpenedEventHandler |
HyperlinkOpening
Occurs when a link from a GridHyperlinkColumn is opening.
Declaration
public event CellHyperlinkOpeningEventHandler HyperlinkOpening
Event Type
Type |
---|
CellHyperlinkOpeningEventHandler |
PasteCellContent
Occurs when each cell is being pasted from clipboard to SfDataGrid control.
Declaration
public event CellCutCopyPasteEventHandler PasteCellContent
Event Type
Type |
---|
CellCutCopyPasteEventHandler |
Remarks
You can cancel or customize each cell is being pasted from the clipboard through
PasteContent
Occurs when the clipboard value is being pasted to SfDataGrid.
Declaration
public event CutCopyPasteEventHandler PasteContent
Event Type
Type |
---|
CutCopyPasteEventHandler |
Remarks
You can cancel or customize the content is being pasted from clipboard to SfDataGrid through
PreviewRowCollapsed
Occurs when the preview row is collapsed.
Declaration
public event EventHandler<PreviewRowCollapsedEventArgs> PreviewRowCollapsed
Event Type
Type |
---|
System.EventHandler<PreviewRowCollapsedEventArgs> |
PreviewRowCollapsing
Occurs when the preview row is collapsing.
Declaration
public event EventHandler<PreviewRowCollapsingEventArgs> PreviewRowCollapsing
Event Type
Type |
---|
System.EventHandler<PreviewRowCollapsingEventArgs> |
PreviewRowExpanded
Occurs when the preview rows is gets expanded.
Declaration
public event EventHandler<PreviewRowExpandedEventArgs> PreviewRowExpanded
Event Type
Type |
---|
System.EventHandler<PreviewRowExpandedEventArgs> |
PreviewRowExpanding
Occurs while expanding the preview row.
Declaration
public event EventHandler<PreviewRowExpandingEventArgs> PreviewRowExpanding
Event Type
Type |
---|
System.EventHandler<PreviewRowExpandingEventArgs> |
PropertyChanged
Occurs when the property value is changed.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type |
---|
System.ComponentModel.PropertyChangedEventHandler |
QueryButtonCellStyle
Occurs while drawing the CellButton cell on the SfDataGrid.
Declaration
public event QueryButtonCellStyleEventHandler QueryButtonCellStyle
Event Type
Type |
---|
QueryButtonCellStyleEventHandler |
Examples
The following example shows how to change the button style at the QueryButtonCellStyle event
sfDataGrid1.QueryButtonCellStyle += sfDataGrid1_CellButtonStyle;
void sfDataGrid1_CellButtonStyle(object sender, QueryButtonCellStyleEventArgs e)
{
if(e.RowIndex == 5 && e.ColumnIndex == 2)
{
if (e.Button.Text == "OK")
{
e.DisplayText = "CellButton";
e.Style.BackColor = Color.Green;
}
}
}
QueryCellStyle
Occurs while changing the cell style.
Declaration
public event QueryCellStyleEventHandler QueryCellStyle
Event Type
Type |
---|
QueryCellStyleEventHandler |
QueryCheckBoxCellStyle
Occurs before drawing the check box of the cell.
Declaration
public event QueryCheckBoxCellStyleEventHandler QueryCheckBoxCellStyle
Event Type
Type |
---|
QueryCheckBoxCellStyleEventHandler |
Remarks
You can customize the style of the each cell with
Examples
The following example shows how to handle the QueryCheckBoxCellStyle event
sfDataGrid1.QueryCheckBoxCellStyle += sfDataGrid1_CellCheckBoxStyle;
void sfDataGrid1_CellCheckBoxStyle(object sender, QueryCheckBoxCellStyleEventArgs e)
{
if (e.Column.MappingName == "Status")
{
e.Style.CheckedBackColor = Color.Green;
e.Style.UncheckedBackColor = Color.Red;
e.Style.CheckBoxAlignment = CellCheckBoxAlignment.Right;
}
}
QueryCoveredRange
Occurs while calculates the merge cells.
Declaration
public event QueryCoveredRangeEventHandler QueryCoveredRange
Event Type
Type |
---|
QueryCoveredRangeEventHandler |
QueryImageCellStyle
Occurs while drawing the image on the grid cell.
Declaration
public event QueryImageCellStyleEventHandler QueryImageCellStyle
Event Type
Type |
---|
QueryImageCellStyleEventHandler |
QueryProgressBarCellStyle
Occurs before the progress bar cell is drawn.
Declaration
public event EventHandler<QueryProgressBarCellStyleEventArgs> QueryProgressBarCellStyle
Event Type
Type |
---|
System.EventHandler<QueryProgressBarCellStyleEventArgs> |
QueryRowHeight
Occurs to query the row height based on row index.
Declaration
public event QueryRowHeightEventHandler QueryRowHeight
Event Type
Type |
---|
QueryRowHeightEventHandler |
Remarks
This event will trigger only for the visible rows.
Examples
The following example shows how to handle the QueryRowHeight event
sfDataGrid1.QueryRowHeight += sfDataGrid1_QueryRowHeight;
int autoRowHeight;
RowAutoFitOptions option = new RowAutoFitOptions();
void sfDataGrid1_QueryRowHeight(object sender, QueryRowHeightEventArgs e)
{
if (sfDataGrid1.AutoSizeController.GetAutoRowHeight(e.RowIndex, option, out autoRowHeight))
{
e.Height = autoRowHeight;
e.Handled = true;
}
}
QueryRowStyle
Occurs when the RowStyle is changed.
Declaration
public event QueryRowStyleEventHandler QueryRowStyle
Event Type
Type |
---|
QueryRowStyleEventHandler |
QueryUnboundColumnInfo
Occurs to query or commit the values for GridUnboundColumn when its cells is initialized or committed. Occurs when the value of each cell in GridUnboundColumn being initialized or committed.
Declaration
public event QueryUnboundColumnInfoHandler QueryUnboundColumnInfo
Event Type
Type |
---|
QueryUnboundColumnInfoHandler |
Remarks
You can customize the value of GridUnboundColumn being initialized in the QueryUnboundColumnInfo event handler.
Examples
// Raises the QueryUnboundColumnInfo event for SfDataGrid.
this.sfDataGrid1.QueryUnboundColumnInfo += sfDataGrid1_QueryUnboundColumnInfo;
// Implement the event method for QueryUnboundColumnInfo.
void sfDataGrid1_QueryUnboundColumnInfo(object sender, QueryUnboundColumnInfoArgs e)
{
if (e.UnboundAction == UnboundActions.QueryData && e.Column.MappingName == "SubTotal")
{
var unitPrice = Convert.ToDouble(e.Record.GetType().GetProperty("UnitPrice").GetValue(e.Record, null));
e.Value = "UnitPrice * 2";
}
else if (e.UnboundAction == UnboundActions.CommitData && e.Column.MappingName == "SubTotal")
{
// save the edited unbound cell value.
object modifiedValue = e.Value;
}
}
QueryUnboundRowInfo
Occurs to query and commit the value and settings for cell in Unbound row.
Declaration
public event QueryUnboundRowInfoHandler QueryUnboundRowInfo
Event Type
Type |
---|
QueryUnboundRowInfoHandler |
Examples
// Raised the QueryUnboundRowInfo event
sfDataGrid1.QueryUnboundRowInfo += dataGrid_QueryUnboundRowInfo;
void dataGrid_QueryUnboundRowInfo (object sender, QueryUnboundRowInfoArgs e)
{
if (e.UnboundAction == UnboundActions.QueryData && e.RowColumnIndex.RowIndex == 3 &&
e.GridUnboundRow.Position == UnboundRowsPosition.Top && e.GridUnboundRow.ShowBelowSummary == true)
{
e.CellType = "DateTimePicker";
e.Value = DateTime.Now;
e.Handled = true;
}
else if (e.UnboundAction == UnboundActions.QueryData)
{
if (e.Column.MappingName == "CustomerID")
{
e.Value = "unbound cell 1";
e.Handled = true;
}
else if (e.Column.MappingName == "ProductName")
{
e.Value = "unbound cell 2";
e.Handled = true;
}
else if(e.Column.MappingName == "Quantity")
{
e.Value = 20;
e.Handled = true;
}
}
else if(e.UnboundAction == UnboundActions.CommitData)
{
object modifiedValue = e.Value;
}
}
RecordDeleted
Occurs after the record is deleted using Delete key.
Declaration
public event RecordDeletedEventHandler RecordDeleted
Event Type
Type |
---|
RecordDeletedEventHandler |
Remarks
This event occurs after the RecordDeleting event if that event is not canceled.
Examples
The following example shows how to customize the RecordDeleted event
//Raise the RecordDeleted event for SfDataGrid.
sfDataGrid1.RecordDeleted += sfDataGrid1_RecordDeleted;
//Handling selection after deleting the record from SfDataGrid
private void sfDataGrid1_RecordDeleted(object sender, RecordDeletedEventArgs e)
{
// Remove current cell after delete the selected records
e.SelectedIndex = -1;
}
RecordDeleting
Occurs when the record is being deleted using Delete key.
Declaration
public event RecordDeletingEventHandler RecordDeleting
Event Type
Type |
---|
RecordDeletingEventHandler |
Remarks
You can cancel or customize the record being deleted through the
Examples
The following example shows how to customize the RecordDeleting event
//Raise the RecordDeleting event for SfDataGrid.
sfDataGrid1.RecordDeleting += sfDataGrid1_RecordDeleting;
//Conditionally deleting records when pressing Delete key by using the RecordDeleting event.
private void sfDataGrid1_RecordDeleting(object sender, RecordDeletingEventArgs e)
{
if ((e.Items[0] as OrderInfo).OrderID == 15)
e.Cancel = true;
}
RowValidated
Occurs when the row is successfully validated.
Declaration
public event RowValidatedEventHandler RowValidated
Event Type
Type |
---|
RowValidatedEventHandler |
RowValidating
Occurs when the row is validating.
Declaration
public event RowValidatingEventHandler RowValidating
Event Type
Type |
---|
RowValidatingEventHandler |
SelectionChanged
Occurs when the current selection changes.
Declaration
public event SelectionChangedEventHandler SelectionChanged
Event Type
Type |
---|
SelectionChangedEventHandler |
Remarks
This event occurs after the
SelectionChanging
Occurs when the selection is being changed in SfDataGrid.
Declaration
public event SelectionChangingEventHandler SelectionChanging
Event Type
Type |
---|
SelectionChangingEventHandler |
Remarks
You can cancel or customize the selection being changed through the
It will be raised only for keyboard and mouse interactions.
SortColumnsChanged
Occurs after the column is sorted in SFDataGrid.
Declaration
public event SortColumnsChangedEventHandler SortColumnsChanged
Event Type
Type |
---|
SortColumnsChangedEventHandler |
Remarks
This event occurs after the SortColumnsChanging event if that event is not cancelled.
SortColumnsChanging
Occurs when the column is being sorted in SFDataGrid .
Declaration
public event SortColumnsChangingEventHandler SortColumnsChanging
Event Type
Type |
---|
SortColumnsChangingEventHandler |
Remarks
You can cancel or customize the column being sorted using the SortColumnsChangingEventArgs event argument. It will be raised for UI based sorting only.
ThemeChanged
Occurs when theme name of the
Declaration
public event ThemeChangedEventHandler ThemeChanged
Event Type
Type |
---|
ThemeChangedEventHandler |
ToolTipOpened
Occurs when the tooltip for the cell is shown.
Declaration
public event ToolTipOpenedEventHandler ToolTipOpened
Event Type
Type |
---|
ToolTipOpenedEventHandler |
ToolTipOpening
Occurs while showing the tooltip for the cell.
Declaration
public event ToolTipOpeningEventHandler ToolTipOpening
Event Type
Type |
---|
ToolTipOpeningEventHandler |
ValidationErrorToolTipOpened
Occurs when the validation error tooltip of the cell is shown.
Declaration
public event ValidationErrorToolTipOpenedEventHandler ValidationErrorToolTipOpened
Event Type
Type |
---|
ValidationErrorToolTipOpenedEventHandler |
ValidationErrorToolTipOpening
Occurs while showing the validation error tooltip of the cell.
Declaration
public event ValidationErrorToolTipOpeningEventHandler ValidationErrorToolTipOpening
Event Type
Type |
---|
ValidationErrorToolTipOpeningEventHandler |