Prerequisite Knowledge DataGrid Fundamentals: Object Model Overview DataGrid Fundamentals: DataGridControl Class |
Through a grid's Columns collection, all the columns in a grid, regardless of their visibility, can be accessed. To access only the visible columns—those whose Visible property is set to true—the VisibleColumns property can be consulted. The value of a column's Index property represents its position within the Columns collection while the visible position of a column can be retrieved through a column's VisiblePosition property, which may or may not correspond to the Index property. In addition to the VisiblePosition property, the IsFirstVisible and IsLastVisible properties can be used to determine if a column is the first or last visible column in a grid. A column-manager row's AllowColumnReorder property can prevent end users from changing the visible positions of columns; however, programmatic changes to a column's visible position can still be made.
At runtime, data items can be grouped using a GroupByControl or HierarchicalGroupByControl, which provide a condensed view of the group levels and allow end users to modify the group descriptions applied to a grid and details (see Figure 1 and 2 in Grouping Data). Each group level is represented by a GroupByItem or HierarchicalGroupByItem, which can be used to change the order of the groups, sort the data items, or remove the groups. A ColumnManagerRow can also be used to group and sort the data items (see Figure 3 and 4 in Grouping Data).
End-user interaction can be limited through the column-manager row's AllowSort property, which prevents columns from being sorted, the AllowGroupingModification property, which prevents groups from being added or removed, the AllowColumnReorder property, which prevents columns from being reordered, and the AllowAutoFilter property, which displays the auto-filter drop down. These properties only affect end-user interaction and do not prevent programmatic changes.
An unbound column is a column that can be used to display non-data related information such as a label or controls that allow some sort of action to be carried out (e.g., a button to open a window in which the current item can be edited). Unlike data bound columns, unbound columns cannot be grouped or sorted, nor can their values be filtered.
Merged column headers (MergedHeader class) can be used to group columns together within "organizational" columns (MergedColumn class) to help present data more clearly and logically; both field-level columns and other merged columns can be organized under merged column headers, which span multiple columns.
The content of each cell in a column—assuming that the column or its cells are not read-only—can be edited at runtime by the end user through the use of cell editors. Cell editors are created from DataTemplates (see Templates) and are used to edit the content of cells. Custom cell editors can be provided per column by setting a column's CellEditor property, or per data type through the DataGridControl's DefaultCellEditors property (see Cell Editors). A column's CellEditorDisplayConditions property can be set to override the display conditions determined by the parent grid.
When a column's CanBeCurrentWhenReadOnly property is false and its ReadOnly property is true, its cells cannot receive focus: clicking on these cells has no effect, and using the keyboard (arrow keys, Tab key, etc.) causes the focus rectangle to skip the cells. Furthermore, the cell's EditTemplate is not displayed. The value of this property is ignored if ReadOnly is set to false.
For more information on editing a validating data, refer to the Editing Data topic.
In addition to the built-in container recycling, which applies to all views, the TableView class provides column virtualization, meaning that columns and cells that are not visible in the viewport are not created until they are brought into the viewport or accessed. How columns and cells are virtualized can be changed by setting the ColumnVirtualizationMode property to a different value. For instance, setting it to None will disable virtualization at the cell level.
For more information, refer to the UI Virtualization topic.
The GroupValueTemplate and GroupValueTemplateSelector properties determine how the value of a group (e.g., "Canada", "France") is displayed, while the GroupConfiguration property determines the configuration of the same-level groups when the data items are grouped according to the values of the column.
A column's Title property represents the data that, by default, is displayed in a column's corresponding column-manager cell and/or group-by item. If the Title property has not been explicitly set, the value of the FieldName property will be used. The DataTemplate used to display a column's title can be modified through the TitleTemplate property while the TitleTemplateSelector property can be used to provide different title templates based on custom criteria (see Templates).
By default, when a grid is in a card-view layout, the data displayed in a card's title (see Card Views) is determined by a grid's main (primary) column. The content of the cell whose field name matches the field name of the main column will be displayed in the corresponding card's title. If left unmodified, the main column will be the first column that is added to a grid's Columns collection; however, the main column can be changed by setting a column's IsMainColumn property to true.
For more information styles and templates, refer to the Styles and Templates topics.
Back to Cell Class | Go to Row Class