New to Telerik UI for WinForms? Start a free 30-day trial

Abstract class, representing the base for all types of columns in RadGridView A special inheritor is the GridViewDataColumn which is base for all data-bound columns.

Implements IComparable and INotifyPropertyChanged interfaces

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.GridView.dll

Syntax:

C#
[TypeConverter(typeof(ExpandableObjectConverter))]
public abstract class GridViewColumn : RadObject, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, IEditorProvider, INotifyPropertyChangingEx, IContextMenuProvider

Inheritance: objectDisposableObjectRadObjectGridViewColumn

Derived Classes: GridViewDataColumnGridViewGroupColumnGridViewIndentColumnGridViewRowHeaderColumnGridViewSelectColumn

Implements: IContextMenuProviderICustomTypeDescriptorIDisposableIEditorProviderINotifyPropertyChangedINotifyPropertyChangingEx...

Inherited Members RadObject.BindingContextPropertyRadObject.RadTypeRadObject.ReplaceDefaultDescriptors(PropertyDescriptorCollection)RadObject.DisposeManagedResources()RadObject.ClearPropertyStore()RadObject.SuspendPropertyNotifications()RadObject.ResumePropertyNotifications()RadObject.GetPropertyValue(RadProperty)RadObject.SetDefaultValueOverride(RadProperty, object)RadObject.GetValue(RadProperty)RadObject.SetValue(RadProperty, object)RadObject.ResetValue(RadProperty)RadObject.ResetLocalValue(RadProperty)RadObject.ResetValue(RadProperty, ValueResetFlags)RadObject.UpdateValue(RadProperty)RadObject.GetValueSource(RadProperty)RadObject.GetRegisteredRadProperty(string)RadObject.UpdateValueCore(RadPropertyValue)RadObject.SetValueCore(RadPropertyValue, object, object, ValueSource)RadObject.ResetValueCore(RadPropertyValue, ValueResetFlags)RadObject.GetDefaultValue(RadPropertyValue, object)RadObject.CoerceValue(RadPropertyValue, object)RadObject.ShouldSerializeProperty(RadProperty)RadObject.CanRaisePropertyChangeNotifications(RadPropertyValue)RadObject.BindProperty(RadProperty, RadObject, RadProperty, PropertyBindingOptions)RadObject.UnbindProperty(RadProperty)RadObject.AddStylePropertySetting(IPropertySetting)RadObject.GetInheritedValue(RadProperty)RadObject.OnNotifyPropertyChanged(string)RadObject.OnNotifyPropertyChanged(PropertyChangedEventArgs)RadObject.OnShouldSerializeProperty(ShouldSerializePropertyEventArgs)RadObject.PropertyValuesRadObject.PropertyFilterRadObject.RadObjectTypeRadObject.BindingContextRadObject.PropertyChangedRadObject.RadPropertyChangedRadObject.RadPropertyChangingDisposableObject.GetBitState(long)DisposableObject.SetBitState(long, bool)DisposableObject.OnBitStateChanged(long, bool, bool)DisposableObject.Dispose()DisposableObject.Dispose(bool)DisposableObject.PerformDispose(bool)DisposableObject.DisposeUnmanagedResources()DisposableObject.BitStateDisposableObject.EventsDisposableObject.IsDisposingDisposableObject.IsDisposedDisposableObject.DisposedDisposableObject.Disposing...

Constructors

Initializes a new instance of the GridViewColumn.

C#
public GridViewColumn()

Initializes a new instance of the GridViewColumn.

C#
public GridViewColumn(string name, string fieldName)
Parameters:namestring

A string value referring to the unique name of the column.

fieldNamestring

A string value referring to the field name to which the column is bound.

Initializes a new instance of the GridViewColumn.

C#
public GridViewColumn(string fieldName)
Parameters:fieldNamestring

A string value referring to the unique name of the column.

Fields

Identifies whether grouping by the column is allowed.

C#
public static RadProperty AllowGroupProperty

Identifies whether users may hide the column.

C#
public static RadProperty AllowHideProperty

Identifies whether the user can reorder the column by dragging it.

C#
public static RadProperty AllowReorderProperty

Identifies whether the user can resize the column.

C#
public static RadProperty AllowResizeProperty

Identifies whether sorting by the column is allowed.

C#
public static RadProperty AllowSortProperty

Identifies whether an ellipsis is shown when cell text does not fit.

C#
public static RadProperty AutoEllipsisProperty

Identifies which cells are considered when BestFit adjusts the column width.

C#
public static RadProperty AutoSizeModeProperty

Identifies whether HTML-like markup is disabled for cell text.

C#
public static RadProperty DisableHTMLRenderingProperty

Identifies whether the column's context menu offers the expression editor.

C#
public static RadProperty EnableExpressionEditorProperty

Identifies the expression used to calculate values for the column; a nonempty expression makes the column read-only.

C#
public static RadProperty ExpressionProperty

Identifies the data-source field or property used by a bound column.

C#
public static RadProperty FieldNameProperty

Identifies the bitmap image displayed in the column header.

C#
public static RadProperty HeaderImageProperty

Identifies the SVG image displayed in the column header.

C#
public static RadProperty HeaderSvgImageProperty

Identifies the alignment of the column header text.

C#
public static RadProperty HeaderTextAlignmentProperty

Identifies the caption displayed in the column header.

C#
public static RadProperty HeaderTextProperty

Identifies how images in the column's cells are laid out.

C#
public static RadProperty ImageLayoutProperty

Identifies whether the column was created automatically from the bound data source.

C#
public static RadProperty IsAutoGeneratedProperty

Identifies whether the current cell in the template belongs to this column.

C#
public static RadProperty IsCurrentProperty

Identifies whether the column is displayed in the grid.

C#
public static RadProperty IsVisibleProperty

Identifies the configured maximum pixel width; a value of 0 does not impose an upper bound.

C#
public static RadProperty MaxWidthProperty

Identifies the minimum pixel width allowed for the column.

C#
public static RadProperty MinWidthProperty

Identifies the unique name used to locate the column in its owning template.

C#
public static RadProperty NameProperty

Identifies whether the column is unpinned or fixed to the left or right while scrolling horizontally.

C#
public static RadProperty PinPositionProperty

Identifies whether cells in the column can be edited; an expression column remains read-only.

C#
public static RadProperty ReadOnlyProperty

Identifies the registered render-width property. Its default is 50, and changes are cancelable.

C#
public static RadProperty RenderWidthProperty

Identifies the vertical span of the column's cells in a column-groups view.

C#
public static RadProperty RowSpanProperty

Identifies the registered ShowEditor property. It defaults to false for this column type; GridViewCheckBoxColumn overrides the default to true.

C#
public static RadProperty ShowEditorProperty

Identifies whether the column is stretched vertically in a column-groups view.

C#
public static RadProperty StretchVerticallyProperty

Identifies the user-defined object associated with the column.

C#
public static RadProperty TagProperty

Identifies the alignment of cell content.

C#
public static RadProperty TextAlignmentProperty

Identifies the placement of header text relative to its image.

C#
public static RadProperty TextImageRelationProperty

Identifies whether the column is listed in the column chooser.

C#
public static RadProperty VisibleInColumnChooserProperty

Identifies the configured column width used by the layout.

C#
public static RadProperty WidthProperty

Identifies whether cell text wraps within the column.

C#
public static RadProperty WrapTextProperty

Properties

Gets or sets a value indicating whether the user can group data based on the content of this column.

C#
[Browsable(true)]
public virtual bool AllowGroup { get; set; }

Gets or sets value indicating whether the user can hide the column.

C#
[Browsable(true)]
public virtual bool AllowHide { get; set; }

Gets or sets a value indicating whether the user can reorder this column using the mouse.

C#
[Browsable(true)]
public virtual bool AllowReorder { get; set; }

Gets or sets value indicating whether the user can resize the column.

C#
[Browsable(true)]
public virtual bool AllowResize { get; set; }

Gets or sets a value indicating whether the user can sort the data in the OwnerTemplate based on the contents of this column.

C#
[Browsable(true)]
public virtual bool AllowSort { get; set; }

Gets or sets the auto ellipsis.

C#
[Browsable(true)]
public bool AutoEllipsis { get; set; }
Property Value:

The auto ellipsis.

Gets or sets the mode by which the column automatically adjusts its width after BestFit is executed.

C#
[Browsable(false)]
public BestFitColumnMode AutoSizeMode { get; set; }

Gets list of BaseFormattingObject instances that define the currently applied conditional formatting of the data in the column.

C#
[Browsable(true)]
public virtual ConditionalFormattingObjectCollection ConditionalFormattingObjectList { get; }

Gets or sets the context menu assigned to the column.

C#
public RadDropDownMenu ContextMenu { get; set; }

Implements: IContextMenuProvider.ContextMenu

Disable or Enable HTML-like text rendering in the column.

C#
[Browsable(true)]
public bool DisableHTMLRendering { get; set; }

Gets or sets the DPI scale.

C#
public SizeF DpiScale { get; }
Property Value:

The dpi scale.

Gets or sets the value indicating if expression editor menu item will be available to the user.

C#
[Browsable(true)]
public bool EnableExpressionEditor { get; set; }

Gets the event dispatcher.

C#
protected EventDispatcher EventDispatcher { get; }
Property Value:

The event dispatcher.

Gets or sets the expression used to calculate the values of this column.

C#
[Browsable(true)]
public string Expression { get; set; }

Gets or sets the name data source property or database column to which the GridViewDataColumn is bound.

C#
[Browsable(true)]
public string FieldName { get; set; }

Gets or set the ColumnInfo Header image.

C#
[Browsable(true)]
[TypeConverter(typeof(ImageTypeConverter))]
public virtual Image HeaderImage { get; set; }

Gets or set the ColumnInfo Header vector image.

C#
[Browsable(true)]
[TypeConverter(typeof(SvgImageTypeConverter))]
public virtual RadSvgImage HeaderSvgImage { get; set; }

Gets or sets the caption text on the column's header cell.

C#
[Browsable(true)]
public virtual string HeaderText { get; set; }

Gets or sets a value indicating the position of the HeaderText within the header cell.

C#
[Browsable(true)]
public ContentAlignment HeaderTextAlignment { get; set; }

Gets or sets the image layout of the image inside the cells.

C#
[Browsable(true)]
public virtual ImageLayout ImageLayout { get; set; }

Gets a value indicating the position of the column in the Columns collection of the OwnerTemplate.

C#
[Browsable(false)]
public int Index { get; }

Gets value indicating whether the column contains the currently selected cell in the OwnerTemplate.

C#
[Browsable(false)]
public bool IsCurrent { get; set; }

Gets a value indicating whether the column is bound to the data field referred by FieldName.

C#
[Browsable(false)]
public virtual bool IsDataBound { get; }

Gets whether is field name path.

C#
[Browsable(false)]
public bool IsFieldNamePath { get; }
Property Value:

The is field name path.

Gets a value indicating whether the data in the OwnerTemplate is grouped based on the content of this column.

C#
[Browsable(false)]
public virtual bool IsGrouped { get; }

Gets or sets value indicating whether the current column is pinned and cannot be moved from its location when a user scrolls horizontally.

C#
[Browsable(true)]
public bool IsPinned { get; set; }

Gets a boolean value indicating whether a sort order of data in the column is currently applied.

C#
[Browsable(false)]
public virtual bool IsSorted { get; }

When multi-column sorting is applied, the column might be partially sorted.

Gets or sets a value indicating whether the column is visible.

C#
[Browsable(true)]
public virtual bool IsVisible { get; set; }

Gets or sets the maximal width, in pixels, of the column.

C#
[Browsable(true)]
public int MaxWidth { get; set; }

Gets or sets the minimum width, in pixels, of the column.

C#
[Browsable(true)]
public int MinWidth { get; set; }

Gets or sets a string value representing the column's unique name in the Columns collection of the OwnerTemplate.

C#
[Browsable(true)]
public virtual string Name { get; set; }

Gets the instance of GridViewTemplate which the column belongs to.

C#
[Browsable(false)]
public GridViewTemplate OwnerTemplate { get; }

Gets or sets the pin position for the row. When the column is pinned, it cannot be moved from its location when a user scrolls horizontally.

C#
public PinnedColumnPosition PinPosition { get; set; }

Gets or sets a value indicating whether the user can edit the data in the column's cells.

C#
[Browsable(true)]
public virtual bool ReadOnly { get; set; }

Gets or sets the vertical span of the cells in that column (the height) in pixels. Relevant only in ColumnGroupsViewDefinition.

C#
[Browsable(true)]
public int RowSpan { get; set; }

Gets or sets a value indicating the sort order of data in the column.

C#
[Browsable(true)]
public RadSortOrder SortOrder { get; set; }

Gets or sets a value indicating whether to stretch the column height vertically. Used with ColumnGroupsViewDefinition.

C#
[Browsable(true)]
public bool StretchVertically { get; set; }

Gets or sets the object that contains data about the column.

C#
[Browsable(false)]
public object Tag { get; set; }

Gets or sets a value indicating the position of the cell content within a column's cells.

C#
[Browsable(true)]
public virtual ContentAlignment TextAlignment { get; set; }

Gets or sets a value indicating the TextImageRelation: ImageAboveText, ImageBeforeText, Overlay, TextAboveImage, and TextBeforeImage.

C#
[Browsable(true)]
public TextImageRelation TextImageRelation { get; set; }

Gets or sets a value indicating whether the column will be visible in ColumnChooserElement.

C#
[Browsable(true)]
public virtual bool VisibleInColumnChooser { get; set; }

Use this property if you want to hide columns from the user.

Gets or sets the width of the column.

C#
[Browsable(true)]
public virtual int Width { get; set; }

Gets or sets value indicating whether the text in each cell in the column should be wrapped.

C#
[Browsable(true)]
public bool WrapText { get; set; }

Methods

Adjusts the column width to fit the contents of all cells in the column, including the header cell.

C#
public void BestFit()

Determines whether this column may be dragged onto the GroupBy panel.

C#
public bool CanDragToGroup()
Returns:

bool

Determines whether this column may be dragged onto the GroupBy panel.

C#
public bool CanDragToGroup(GridViewTemplate template)
Parameters:templateGridViewTemplateReturns:

bool

Creates the conditional formatting form.

C#
protected virtual ConditionalFormattingForm CreateConditionalFormattingForm()
Returns:

ConditionalFormattingForm

Adds the column's available sort, grouping, formatting, sizing, and expression commands to its header context menu.

C#
protected virtual void CreateContextMenuItems(RadDropDownMenu menu)
Parameters:menuRadDropDownMenu

The menu to populate.

Dispatches the event.

C#
protected virtual void DispatchEvent(KnownEvents id, GridEventType type, GridEventDispatchMode dispatchMode, object originator, object[] arguments)
Parameters:idKnownEvents

The id.

typeGridEventType

The type.

dispatchModeGridEventDispatchMode

The dispatch mode.

originatorobject

The originator.

argumentsobject[]

The arguments.

Returns the type of cell element to be created for the specified row.

C#
public virtual Type GetCellType(GridViewRowInfo row)
Parameters:rowGridViewRowInfo

The specified row.

Returns:

Type

The type of the cell to be created.

Returns an editor instance of the default type for the editor provider.

C#
public virtual IInputEditor GetDefaultEditor()
Returns:

IInputEditor

An object that implements IInputEditor interface.

Implements: IEditorProvider.GetDefaultEditor()

Gets the default editor type for the editor provider.

C#
public virtual Type GetDefaultEditorType()
Returns:

Type

The default type.

Implements: IEditorProvider.GetDefaultEditorType()

Retrieves the default group-by expression string for the column.

C#
public virtual string GetDefaultGroupByExpression()
Returns:

string

The string value representing a group-by expression with default settings.

Gets a value indicating default minimum width for the inherited column type. If not overridden in inheritor class it defaults to 5.

C#
protected virtual int GetDefaultMinWidth()
Returns:

int

Gets the event info.

C#
protected virtual GridEventType GetEventInfo(RadProperty property, out GridEventDispatchMode dispatchMode)
Parameters:propertyRadProperty

The property.

dispatchModeGridEventDispatchMode

The dispatch mode.

Returns:

GridEventType

Initializes the column.

C#
protected virtual void Initialize()

This method is called when the column is associated with GridViewTemplate.

Initializes a specified editor.

C#
public virtual void InitializeEditor(IInputEditor editor)
Parameters:editorIInputEditor

An object that implements IInputEditor interface.

Implements: IEditorProvider.InitializeEditor(IInputEditor)

Determines whether the specified property may be canceled.

C#
protected override bool IsPropertyCancelable(RadPropertyMetadata metadata)
Parameters:metadataRadPropertyMetadata

The metadata associated with the property change.

Returns:

bool

Overrides: RadObject.IsPropertyCancelable(RadPropertyMetadata)

Creates the column header menu when the owning template allows header context menus.

C#
public RadDropDownMenu MergeMenus(IContextMenuManager contextMenuManager, params object[] parameters)
Parameters:contextMenuManagerIContextMenuManager

The manager requesting the menu.

parametersobject[]

Additional merge parameters; this implementation does not use them.

Returns:

RadDropDownMenu

A newly populated menu, or null if the column is unattached or header menus are disabled.

Implements: IContextMenuProvider.MergeMenus(IContextMenuManager, params object[])

Does not merge another provider's menu; this overload returns null.

C#
public RadDropDownMenu MergeMenus(IContextMenuProvider contextMenuProvider, params object[] parameters)
Parameters:contextMenuProviderIContextMenuProvider

The provider whose menu would be merged; this implementation does not use it.

parametersobject[]

Additional merge parameters; this implementation does not use them.

Returns:

RadDropDownMenu

null.

Implements: IContextMenuProvider.MergeMenus(IContextMenuProvider, params object[])

Does not merge a supplied menu; this overload returns null.

C#
public RadDropDownMenu MergeMenus(RadDropDownMenu contextMenu, params object[] parameters)
Parameters:contextMenuRadDropDownMenu

The menu to merge; this implementation does not use it.

parametersobject[]

Additional merge parameters; this implementation does not use them.

Returns:

RadDropDownMenu

null.

Implements: IContextMenuProvider.MergeMenus(RadDropDownMenu, params object[])

Forwards a pre-change notification to PropertyChanging subscribers.

C#
protected virtual void OnNotifyPropertyChanging(PropertyChangingEventArgsEx e)
Parameters:ePropertyChangingEventArgsEx

The property name and any old or new values supplied by the caller.

Raises the PropertyChanging event for the specified property name.

C#
protected void OnNotifyPropertyChanging(string propertyName)
Parameters:propertyNamestring

The name of the property about to change.

Updates dependent column state and dispatches notifications after a property changes.

C#
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Parameters:eRadPropertyChangedEventArgs

The property change details.

Overrides: RadObject.OnPropertyChanged(RadPropertyChangedEventArgs)

Validates width, current-column, visibility, and name changes before applying them.

C#
protected override void OnPropertyChanging(RadPropertyChangingEventArgs e)
Parameters:eRadPropertyChangingEventArgs

The pending property change; width changes may be canceled by the column-width changing event.

Overrides: RadObject.OnPropertyChanging(RadPropertyChangingEventArgs)

Shows the context menu.

C#
public virtual void ShowContextMenu()

Sorts the specified sort order.

C#
public bool Sort(RadSortOrder sortOrder, bool multiSortMode)
Parameters:sortOrderRadSortOrder

The sort order.

multiSortModebool

if set to true [multi sort mode].

Returns:

bool

Sorts with the specified sort order.

C#
public virtual void Sort(RadSortOrder sortOrder)
Parameters:sortOrderRadSortOrder

The sort order.

Toggles the column sort order.

C#
protected void ToggleSortOrder()

Returns a string representation of the column.

C#
public override string ToString()
Returns:

string

The string representation for the column.

Overrides: object.ToString()

Events

Occurs when the column announces a pending property change; the base implementation uses this notification before changing the owner template.

C#
public event PropertyChangingEventHandlerEx PropertyChanging

Implements: INotifyPropertyChangingEx.PropertyChanging

In this article
DefinitionConstructorsGridViewColumn()GridViewColumn(string, string)GridViewColumn(string)FieldsAllowGroupPropertyAllowHidePropertyAllowReorderPropertyAllowResizePropertyAllowSortPropertyAutoEllipsisPropertyAutoSizeModePropertyDisableHTMLRenderingPropertyEnableExpressionEditorPropertyExpressionPropertyFieldNamePropertyHeaderImagePropertyHeaderSvgImagePropertyHeaderTextAlignmentPropertyHeaderTextPropertyImageLayoutPropertyIsAutoGeneratedPropertyIsCurrentPropertyIsVisiblePropertyMaxWidthPropertyMinWidthPropertyNamePropertyPinPositionPropertyReadOnlyPropertyRenderWidthPropertyRowSpanPropertyShowEditorPropertyStretchVerticallyPropertyTagPropertyTextAlignmentPropertyTextImageRelationPropertyVisibleInColumnChooserPropertyWidthPropertyWrapTextPropertyPropertiesAllowGroupAllowHideAllowReorderAllowResizeAllowSortAutoEllipsisAutoSizeModeConditionalFormattingObjectListContextMenuDisableHTMLRenderingDpiScaleEnableExpressionEditorEventDispatcherExpressionFieldNameHeaderImageHeaderSvgImageHeaderTextHeaderTextAlignmentImageLayoutIndexIsCurrentIsDataBoundIsFieldNamePathIsGroupedIsPinnedIsSortedIsVisibleMaxWidthMinWidthNameOwnerTemplatePinPositionReadOnlyRowSpanSortOrderStretchVerticallyTagTextAlignmentTextImageRelationVisibleInColumnChooserWidthWrapTextMethodsBestFit()CanDragToGroup()CanDragToGroup(GridViewTemplate)CreateConditionalFormattingForm()CreateContextMenuItems(RadDropDownMenu)DispatchEvent(KnownEvents, GridEventType, GridEventDispatchMode, object, object[])GetCellType(GridViewRowInfo)GetDefaultEditor()GetDefaultEditorType()GetDefaultGroupByExpression()GetDefaultMinWidth()GetEventInfo(RadProperty, out GridEventDispatchMode)Initialize()InitializeEditor(IInputEditor)IsPropertyCancelable(RadPropertyMetadata)MergeMenus(IContextMenuManager, params object[])MergeMenus(IContextMenuProvider, params object[])MergeMenus(RadDropDownMenu, params object[])OnNotifyPropertyChanging(PropertyChangingEventArgsEx)OnNotifyPropertyChanging(string)OnPropertyChanged(RadPropertyChangedEventArgs)OnPropertyChanging(RadPropertyChangingEventArgs)ShowContextMenu()Sort(RadSortOrder, bool)Sort(RadSortOrder)ToggleSortOrder()ToString()EventsPropertyChanging
Not finding the help you need?
Contact Support