Basic Column
GridViewColumn is the base column type on top of which the other columns are built. It provides the common functionality typical for RadGridView's columns.
GridViewColumn inherits from FrameworkContentElement.
You can add aggregate functions to display their result in the column footers, manage the headers and cells, apply different styling for the its header and cells, reorder it, etc.
The most common usage of this type of column is when you want to define a column that doesn't bind to any data.
Such a column is frequently referred as “unbound” column.
A typical usage of such column involves setting the CellStyle/CellTemplate properties in order to place custom content within the cells such as buttons, checkboxes or even composite user controls rather than displaying data from the items source. You can check the Setting CellTemplate and CellEditTemplate article for more information on how to define your own CellTemplate or CellEditTemplate.
Key Features and Properties
Here is a list of the most important properties and how they can be used.
AggregateFunctions: This property allows defining aggregate functions, which results will appear in the column footer. Read more here.
CellEditTemplate, CellStyle, CellTemplate: By setting these properties you are able to modify the default look of the cells in the columns e.g. to place custom elements in the cell. Read more here and here.
Footer, FooterCellStyle, GroupFooterStyle: By setting these properties you are able to modify the content and the appearance of the column footers. To learn how read the Column Footers topic.
Header, HeaderCellStyle: By setting these properties you can modify the content and the appearance of the column headers. More about the headers can be found in the Column Headers topic.
ToolTipTemplate: Set to a DataTemplate to be shown when the mouse is over the column. Read more at Add ToolTip for columns and headers topic.
ToolTipTemplateSelector: Gets or sets the data template selector for the cell tooltip.
IsFrozen: Indicates whether the column is frozen or not. To learn more read the Frozen Columns topic.
IsGroupable: Indicates whether the data in the RadGridView can be grouped by this column. More about grouping is to be found here.
IsReadOnly: Indicates whether the cells in the column can be edited. More about editing the data in the RadGridView can be found here.
IsReordable: Indicates whether the column can change its place in relation to the other columns in the collection. To learn more read the Reordering Columns topic.
IsResizable: Indicates whether the user is allowed to resize the column. To learn more read the Resizing Columns topic.
IsSortable: Indicates whether the user is allowed to sort by this column. More about sorting the data in the RadGridView can be found here.
IsFilterable: Indicates whether the column can be filtered or not and whether the filtering UI (e.g. the funnel) is displayed in the respective header. More about filtering can be found here.
ShowDistinctFilters: Indicates whether the user will see the distinct values in the filtering dialog. To learn more read the Filtering topics.
ShowFieldFilters: Indicates whether the user will see the field filters (for manual entering the filter text) in the filtering dialog. To learn more read the Filtering topics.
FilterMemberPath: Gets or sets the FilterMemberPath for this column. More about Filter Member Path can be found here.
FilterMemberType: Gets or sets the filter member type of the column. Set this property when the type cannot be automatically discovered from the FilterMemberPath.
SortingState: Provides information about how the data is sorted - ascending, descending or not sorted. More about sorting the data in the RadGridView can be found here.
GroupMemberPath: Defines the name of the property the data in the column will be grouped by.
SortMemberPath: Defines the name of the property the data in the column will be sorted by.
GroupHeaderFormatString: Defines the format of the group header.
ShowColumnWhenGrouped: Indicates whether the column should be visible when grid is grouped by this column.
TabStopMode: Gets or sets the tab stop mode which denotes if cell could gain focus via TAB key.
TextDecorations: Gets or sets the text decoration. Affects all the cells in the column. This is a dependency property.
TextTrimming: Gets or sets TextTrimming that will be used to trim the text in this column cells. This is a dependency property.
HeaderTextTrimming: Gets or sets HeaderTextTrimming that will be used to trim the text in this column header. This is a dependency property.
TextWrapping: Gets or sets TextWrapping that will be used to wrap the text in this column cells. This is a dependency property.
Example
Here is how to define a column of this type.
Example 1: Define GridViewColumn in XAML:
<telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
<telerik:RadGridView.Resources>
<DataTemplate x:Key="gridViewColumCellTemplate">
<telerik:RadButton Content="More Details"/>
</DataTemplate>
</telerik:RadGridView.Resources>
<telerik:RadGridView.Columns>
<telerik:GridViewColumn Header="My Column" CellTemplate="{StaticResource gridViewColumCellTemplate}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
Example 2: Define GridViewColumn in code:
GridViewColumn column = new GridViewColumn();
column.Header = "My Column";
column.CellTemplate= this.radGridView.Resources["gridViewColumCellTemplate"] as DataTemplate;
this.radGridView.Columns.Add(column);
Dim column As New GridViewColumn()
column.Header = "My Column"
column.CellTemplate = TryCast(Me.radGridView.Resources("gridViewColumCellTemplate"), System.Windows.DataTemplate)
Me.radGridView.Columns.Add(column)