Class GridColumnBase
Represents a class that holds the basic information of the grid column.
Inherited Members
Namespace: Syncfusion.WinForms.DataGrid
Assembly: Syncfusion.SfDataGrid.WinForms.dll
Syntax
public class GridColumnBase : SfGridColumnBase<TableControl>, IDisposable, IFilterDefinition
Constructors
GridColumnBase()
Declaration
public GridColumnBase()
Properties
ActualWidth
Gets the actual width of the column. It is the actual display width of the column when auto sized based on
Declaration
[Cloneable(true)]
public double ActualWidth { get; }
Property Value
Type |
---|
System.Double |
AdvancedFilterType
Gets or sets the filter pop up mode for the column.
Declaration
[Cloneable(true)]
public AdvancedFilterType AdvancedFilterType { get; set; }
Property Value
Type |
---|
AdvancedFilterType |
AllowBlankFilters
Gets or sets a value indicating whether the Blank filter option can be enabled for the filter pop up.
Declaration
[Cloneable(true)]
public bool AllowBlankFilters { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowDragging
Gets or sets a value indicating whether the user can rearrange the columns.
Declaration
[Cloneable(true)]
public bool AllowDragging { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the user can drag and drop the column to another column to change order; otherwise, false. The default value is false. |
AllowEditing
Gets or sets a value indicating whether editing is allowed for the column 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 a column.
Declaration
[Cloneable(true)]
public bool AllowFiltering { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowFocus
Gets or sets a value indicating whether the column can be focused or not.
Declaration
[Cloneable(true)]
public bool AllowFocus { 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 . |
AllowHeaderTextWithImage
Gets or sets a value indicating whether the header text will be display with image.
Declaration
[Cloneable(true)]
public bool AllowHeaderTextWithImage { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
This is property is applicable when HeaderImage is set for a column.
AllowHeaderTextWrapping
Gets or sets a value indicating whether the header cell display text should be wrapped or not when text length exceeds cell rectangle. Default value is false.
Declaration
[Cloneable(true)]
public bool AllowHeaderTextWrapping { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowResizing
Gets or sets a value indicating whether the column can be resized by using the resizing cursor.
Declaration
[Cloneable(true)]
public bool AllowResizing { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowSorting
Gets or sets a value indicating whether the user can sort the data by clicking on its header cell of column.
Declaration
[Cloneable(true)]
public bool AllowSorting { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowTextWrapping
Gets or sets a value indicating whether the cell display text should be wrapped or not when text length exceeds cell rectangle. This is applicable also for header of a column. Default value is false.
Declaration
[Cloneable(true)]
public bool AllowTextWrapping { get; set; }
Property Value
Type |
---|
System.Boolean |
AutoSizeColumnsMode
Gets or sets the value that indicates how the column widths are determined.
Declaration
[Cloneable(true)]
public AutoSizeColumnsMode AutoSizeColumnsMode { get; set; }
Property Value
Type |
---|
AutoSizeColumnsMode |
CellStyle
Gets or sets the cell style of the columns.
Declaration
[Cloneable(true)]
public CellStyleInfo CellStyle { get; set; }
Property Value
Type |
---|
CellStyleInfo |
ColumnMemberType
Gets or sets the member type to load the appropriate filter type to the FilterControl.
Declaration
[Cloneable(true)]
public Type ColumnMemberType { get; set; }
Property Value
Type | Description |
---|---|
System.Type | The type that specifies the advanced filter mode for the GridColumn. |
EnableCaseSensitiveFilterRow
Gets or sets a value indicating whether the case sensitive filter row can be enabled for the column.
Declaration
[Cloneable(true)]
public bool EnableCaseSensitiveFilterRow { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableCaseSensitiveFiterRow
Gets or sets a value indicating whether the case sensitive filter row can be enabled for the column.
Declaration
[Cloneable(true)]
[Obsolete("This property is deprecated, please use EnableCaseSensitiveFilterRow property instead.")]
public bool EnableCaseSensitiveFiterRow { get; set; }
Property Value
Type |
---|
System.Boolean |
FilterBehavior
Gets or sets the filter behavior for the column.
Declaration
[Cloneable(true)]
public FilterBehavior FilterBehavior { get; set; }
Property Value
Type |
---|
FilterBehavior |
FilteredFrom
Gets a value indicating whether the filtering is applied from the programmatic, check box or advanced filter.
Declaration
[Cloneable(true)]
public FilteredFrom FilteredFrom { get; }
Property Value
Type |
---|
FilteredFrom |
FilterMode
Gets or sets a value that decides whether to filter based on display value or actual value.
Declaration
[Cloneable(true)]
public ColumnFilter FilterMode { get; set; }
Property Value
Type |
---|
ColumnFilter |
FilterPopupMode
Gets or sets the filter pop up mode for the column.
Declaration
[Cloneable(true)]
public FilterPopupMode FilterPopupMode { get; set; }
Property Value
Type |
---|
FilterPopupMode |
FilterPredicates
Gets the FilterPredicate added for the GridColumns.
Declaration
public ObservableCollection<FilterPredicate> FilterPredicates { get; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<FilterPredicate> |
FilterRowCondition
Gets or sets a value that decides the default FilterRowCondition that have to be filter while typing in corresponding FilterRow cell.
Declaration
[Cloneable(true)]
public FilterRowCondition FilterRowCondition { get; set; }
Property Value
Type |
---|
FilterRowCondition |
FilterRowEditorType
Gets or sets the Filter row editor type for the column.
Declaration
[Cloneable(true)]
public string FilterRowEditorType { get; set; }
Property Value
Type |
---|
System.String |
FilterRowText
Gets or sets the filter row text for the corresponding column.
Declaration
[Cloneable(true)]
public object FilterRowText { get; set; }
Property Value
Type |
---|
System.Object |
Format
Gets or sets the format pattern string for a column.
Declaration
[Cloneable(true)]
public string Format { get; set; }
Property Value
Type |
---|
System.String |
Examples
The column format can be set in the following ways
//The format string for a column to format the number value in three digits.
sfDataGrid1.Columns["CustomerID"].Format = "{0:000}";
//The format string composed of some combination of static text for a column to format the date value.
sfDataGrid1.Columns["OrderDate"].Format = "Date: {0:yyyy MMMM}";
FormatProvider
Gets or sets the custom format provider that decides how cell values should be formatted.
Declaration
[Cloneable(true)]
public IDataGridFormatProvider FormatProvider { get; set; }
Property Value
Type |
---|
IDataGridFormatProvider |
Examples
The custom format provider which is derived from either IDataGridFormatProvider or IFormatProvider.
//Sets the format provider which was derived from the IGridFormat provider
sfDataGrid1.Columns["OrderDate"].Format = new CustomFormatter();
//Sets the format provider which was derived from the IFormatProvider.
sfDataGrid1.Columns["CustomerID"].Format = new Formatter();
When derive the format provider from IDataGridFormatProvider which provides option to customize based on the record and column information. Please find the format provider which was derived from IDataGridFormatProvider below,
public class CustomFormatter : IDataGridFormatProvider
{
public GridColumn Column { get; set; }
public object Record { get; set; }
public string Format(string format, object arg, IFormatProvider formatProvider)
{
if ((arg == null) || (arg == null))
{
throw new ArgumentNullException((arg == null) ? "format" : "args");
}
if (Column is GridColumn && (Column as GridColumn).MappingName == "CustomerID" &&
Record is OrderInfo && (Record as OrderInfo).ShipCountry == "Canada")
{
string value = arg.ToString();
value = "Can-" + value;
return value;
}
return arg.ToString();
}
public object GetFormat(Type formatType)
{
return this;
}
}
Please find the format provider which was derived from the IFormatProvider below,
public class CustomFormat : IFormatProvider, ICustomFormatter
{
public string Format(string format, object arg, IFormatProvider formatProvider
{
if (format == "C")
{
int value = Convert.ToInt16(arg);
if (value > 100)
return "Minimum Value";
else
return "Maximum Value";
}
return arg.ToString();
}
public object GetFormat(Type formatType)
{
return this;
}
}
GroupMode
Gets or sets a value that decides whether grouping is processed based on display value or cell value of a column.
Declaration
[Cloneable(true)]
public DataReflectionMode GroupMode { get; set; }
Property Value
Type |
---|
DataReflectionMode |
HeaderImage
Gets or sets the header image for the GridImageColumn.
Declaration
[Cloneable(true)]
public Image HeaderImage { get; set; }
Property Value
Type |
---|
System.Drawing.Image |
HeaderStyle
Gets or sets the header style of the column.
Declaration
[Cloneable(true)]
public HeaderStyleInfo HeaderStyle { get; set; }
Property Value
Type |
---|
HeaderStyleInfo |
HeaderText
Gets or sets the header text of the column.
Declaration
[Cloneable(true)]
public string HeaderText { get; set; }
Property Value
Type |
---|
System.String |
HeaderTextImageRelation
Gets or sets the position of the text and image relative to each other.
Declaration
[Cloneable(true)]
public TextImageRelation HeaderTextImageRelation { get; set; }
Property Value
Type |
---|
System.Windows.Forms.TextImageRelation |
ImmediateUpdateColumnFilter
Gets or sets a value indicating whether the data is automatically filtered as soon as an user selects or types value in the filter pop-up of column.
Declaration
[Cloneable(true)]
public bool ImmediateUpdateColumnFilter { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the data is filtered automatically ; otherwise false .The default value is false. |
IsAutoGenerated
Gets a value indicating whether a column is generated automatically.
Declaration
[Cloneable(true)]
public bool IsAutoGenerated { get; }
Property Value
Type |
---|
System.Boolean |
MappingName
Gets or sets the mapping name of the column.
Declaration
[Cloneable(true)]
public string MappingName { get; set; }
Property Value
Type |
---|
System.String |
MaximumWidth
Gets or sets the maximum width of the column.
Declaration
[Cloneable(true)]
public double MaximumWidth { get; set; }
Property Value
Type |
---|
System.Double |
Remarks
The column width could not be set or auto sized greater than the MaximumWidth.
MinimumWidth
Gets or sets the minimum width of the column.
Declaration
[Cloneable(true)]
public double MinimumWidth { get; set; }
Property Value
Type |
---|
System.Double |
Remarks
The column width could not be set or auto sized lesser than the MinimumWidth.
NullDisplayText
Gets or sets a text to be displayed instead of the null or empty text in the cells of a column.
Declaration
[Cloneable(true)]
public string NullDisplayText { get; set; }
Property Value
Type |
---|
System.String |
ShowFilterRowOptions
Gets or sets a value indicating whether the FilterRowOptions can be enabled or not.
Declaration
[Cloneable(true)]
public bool ShowFilterRowOptions { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowHeaderToolTip
Gets or sets a value indicating whether the tooltip should be displayed when mouse hovered on the header cell of the column.
Declaration
[Cloneable(true)]
public bool ShowHeaderToolTip { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowToolTip
Gets or sets a value indicating whether the tooltip should be displayed when mouse hovered on cells of the Column.
Declaration
[Cloneable(true)]
public bool ShowToolTip { get; set; }
Property Value
Type |
---|
System.Boolean |
SortMode
Gets or sets a value that decides whether sorting is processed based on display value or cell value of a column.
Declaration
[Cloneable(true)]
public DataReflectionMode SortMode { get; set; }
Property Value
Type |
---|
DataReflectionMode |
TextTrimming
Gets or sets a value that indicates how text trimmed when it exceeds the edges of the cell text rectangle. Default value is EllipsisCharacter.
Declaration
[Cloneable(true)]
public StringTrimming TextTrimming { get; set; }
Property Value
Type |
---|
System.Drawing.StringTrimming |
Remarks
Set AllowTextWrapping property as False to enable text trimming.
ValidationMode
Gets or sets a value indicating the validation mode of the column.
Declaration
[Cloneable(true)]
public GridValidationMode ValidationMode { get; set; }
Property Value
Type |
---|
GridValidationMode |
Visible
Gets or sets a value indicating whether the column can be visible.
Declaration
[Cloneable(true)]
public bool Visible { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
This is used to collapse the visibility of the column in the view.
Width
Gets or sets the width of the column.
Declaration
[Cloneable(true)]
public double Width { get; set; }
Property Value
Type |
---|
System.Double |
Remarks
If value is lesser than MinimumWidth, then MinimumWidth is set to Width. Otherwise, If value is greater than MaximumWidth, then the MaximumWidth is set to Width.
Methods
Dispose(Boolean)
Overridden to dispose the resources used by the GridColumn.
Declaration
protected override void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing | Specifies the value whether the control is in disposing or not. |
Overrides
GetFormattedValue(Object, Object)
Gets the formatted cell display text.
Declaration
protected virtual object GetFormattedValue(object record, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | record | A record. |
System.Object | value | Cell display text value. |
Returns
Type | Description |
---|---|
System.Object | Returns the formatted value. |