DataGridColumn Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Represents a DataGrid column.

Inheritance Hierarchy

System.Object
  System.Windows.DependencyObject
    System.Windows.Controls.DataGridColumn
      System.Windows.Controls.DataGridBoundColumn
      System.Windows.Controls.DataGridTemplateColumn

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

Syntax

'Declaration
<StyleTypedPropertyAttribute(Property := "DragIndicatorStyle", StyleTargetType := GetType(ContentControl))> _
<StyleTypedPropertyAttribute(Property := "HeaderStyle", StyleTargetType := GetType(DataGridColumnHeader))> _
<StyleTypedPropertyAttribute(Property := "CellStyle", StyleTargetType := GetType(DataGridCell))> _
Public MustInherit Class DataGridColumn _
    Inherits DependencyObject
[StyleTypedPropertyAttribute(Property = "DragIndicatorStyle", StyleTargetType = typeof(ContentControl))]
[StyleTypedPropertyAttribute(Property = "HeaderStyle", StyleTargetType = typeof(DataGridColumnHeader))]
[StyleTypedPropertyAttribute(Property = "CellStyle", StyleTargetType = typeof(DataGridCell))]
public abstract class DataGridColumn : DependencyObject

The DataGridColumn type exposes the following members.

Constructors

  Name Description
Protected method DataGridColumn Initializes a new instance of the DataGridColumn class.

Top

Properties

  Name Description
Public property ActualWidth Gets the current width of the column in pixels.
Public property CanUserReorder Gets or sets a value that indicates whether the user can change the column display position by dragging the column header.
Public property CanUserResize Gets or sets a value that indicates whether the user can adjust the column width using the mouse.
Public property CanUserSort Gets or sets a value that indicates whether the user can sort the column by clicking the column header.
Public property CellStyle Gets or sets the style that is used when rendering cells in the column.
Public property ClipboardContentBinding Gets or sets the binding that provides access to cell contents for clipboard operations.
Public property Dispatcher Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
Public property DisplayIndex Gets or sets the display position of the column relative to the other columns in the DataGrid.
Public property DragIndicatorStyle Gets or sets the style that is used to render the column while it is being dragged.
Public property Header Gets or sets the content of the column header.
Public property HeaderStyle Gets or sets the style that is used when rendering the column header.
Public property IsAutoGenerated Gets a value that indicates whether the column is auto-generated.
Public property IsFrozen Gets a value that indicates whether the column is prevented from scrolling horizontally.
Public property IsReadOnly Gets or sets a value that indicates whether cells in the column can be edited.
Public property MaxWidth Gets or sets the maximum column width in pixels.
Public property MinWidth Gets or sets the minimum column width in pixels.
Public property SortMemberPath Gets or sets a property name, or a period-delimited hierarchy of property names, that indicates the member to sort by.
Public property Visibility Gets or sets the visibility of the column.
Public property Width Gets or sets the column width or an automatic sizing mode.

Top

Methods

  Name Description
Protected method CancelCellEdit When overridden in a derived class, causes the column cell being edited to revert to the unedited value.
Public method CheckAccess Determines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public method ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject.)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Protected method GenerateEditingElement When overridden in a derived class, gets an editing element that is bound to the column's Binding property value.
Protected method GenerateElement When overridden in a derived class, gets a read-only element that is bound to the column's Binding property value.
Public method GetAnimationBaseValue Returns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.)
Public method GetCellContent(DataGridRow) Gets the Content property value for the cell at the intersection of this column and the specified row.
Public method GetCellContent(Object) Gets the Content property value for the cell at the intersection of this column and the row that represents the specified data item.
Public methodStatic member GetColumnContainingElement Returns the column that contains the specified element.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method NotifyPropertyChanged Called by a specific column type when one of its properties changes and its current cells need to be updated.
Protected method PrepareCellForEdit When overridden in a derived class, called when a cell in the column enters editing mode.
Public method ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Protected method RefreshCellContent Refreshes the contents of a cell in the column in response to a column property value change.
Public method SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

This abstract class provides the base functionality for all DataGrid columns.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.