Telerik UI for Windows 8 XAML

Note

Generally, DataGrid columns can be defined:

  • Manually - by adding columns to the RadDataGrid.Columns collection

  • Automatically - by setting RadDataGrid.AutoGenerateColumns="True"

  • Mixed - by adding columns to the RadDataGrid.Columns collection and also set RadDataGrid.AutoGenerateColumns="True"

Important

The RadDataGrid supports Column Reordering by default. You can enable/disable this feature through the RadDataGrid.UserColumnReorderMode property.

The RadDataGrid control provides the following type of columns:

  • Template Column - Represents a column that uses a DataTemplate to describe the content of each associated grid cell.

  • Boolean Column - A special DataGridTypedColumn implementation that presents boolean data.

  • Date Column - An extended DataGridTextColumn that presents data of type DateTime. The column will create a DataGridDateFilterControl upon trigerring the filtering UI through user input.

  • Image Column - Represents a concrete DataGridTypedColumn that may present the associated data through Image controls.

  • Numerical Column - Represents an extended DataGridTextColumn that presents numerical data. The column will create a DataGridNumericalFilterControl upon trigerring the filtering UI through user input.

  • Text Column - Represents a column that converts the content of each associated cell to a System.String object.

  • Time Column - Represents an extended DataGridTextColumn that presents data of type DateTime. The column will create a DataGridTimeFilterControl upon trigerring the filtering UI through user input.

Note

When RadDataGrid.AutoGenerateColumns="True" the RadDataGrid generates typed columns depending on the incoming data.

Both types of columns inherit from the DataGridColumn class which provides the following properties:

  • CellDecorationStyle - Gets or sets the Style object that defines the background of each cell associated with this column. The TargetType property of the Style object is Rectangle.

  • CellDecorationStyleSelector - Gets or sets the StyleSelector instance that allows for dynamic decoration on a per cell basis.

  • Header - Gets or sets the content to be displayed in the Header UI that represents the column.

  • HeaderStyle - Gets or sets the Style instance that defines the appearance of the DataGridColumnHeader control.

  • SizeMode - Gets or sets the DataGridColumnSizeMode value that controls how the column and its associated cells are sized horizontally.

    • Fixed

      - The column has a fixed width as defined by its Width property.

    • Stretch

      - The column is stretched to the available width proportionally to its desired width.

    • Auto

      - The columns is sized to its desired width. That is the maximum desired width of all associated cells.

  • Width - Gets or sets the fixed width for the column. Applicable when the SizeMode property is set to DataGridColumnSizeMode.Fixed.

  • ActualWidth - Gets the actual width of the column.

  • IsAutoGenerated - Gets a value indication whether the column is auto-generated internally.

  • SortDirection - Gets or sets a value that defines the visual state of the SortingDirectionGlyph. This property is used for visualization purposes only and does not affect the actual sort state of the column. To add sorting to the column, you have to use a Sort Descriptor.

  • CanUserEdit (bool) - Gets or sets a value indicating whether the user can edit the values in this column.

  • CanUserFilter (bool) - Gets or sets a value indicating whether the user can filter the data by tha values in the column using the built-in filtering UI.

  • CanUserGroup (bool) - Gets or sets a value indicating whether the user can group the data by tha values in the column using the built-in Grouping UI.

  • CanUserSort (bool) - Gets or sets a value indicating whether the user can sort the data by the values in the column isong the built-in Sorting UI.

  • CanUserReorder (bool) - Gets or sets a value indicating whether the user can reorder the column.