New to Telerik UI for WPFStart a free 30-day trial

Expression Column

Updated on Sep 15, 2025

GridViewExpressionColumn derives from the GridViewColumn class and allows you to display various calculations in RadGridView itself. The GridViewExpressionColumn can be sorted and grouped like any other type of column.

For the purposes of this example, we will use the objects and viewmodel defined in examples 1 and 2.

Example 1: The Product class

C#
    public class Product
    {
        public int ProductID { get; set; }
        public string ProductName { get; set; }
        public int UnitPrice { get; set; }
        public int UnitsInStock { get; set; }
    }

Example 2: The viewmodel

C#
    public class MainViewModel : ViewModelBase
    {
        private ObservableCollection<Product> products;

        public ObservableCollection<Product> Products
        {
            get
            {
                if (this.products == null)
                {
                    this.products = new ObservableCollection<Product>();
                    for (int i = 1; i <= 5; i++)
                    {
                        this.products.Add(new Product() { ProductID = i, ProductName = "Product " + i, UnitPrice = i * 10, UnitsInStock = i });
                    }
                }

                return this.products;
            }
        }
    }

With this data setup, we can bind the GridViewExpressionColumn as shown in Example 3.

Example 3: Define GridViewExpressionColumn in XAML

XAML
	<telerik:RadGridView x:Name="GridView" ItemsSource="{Binding Products}" AutoGenerateColumns="False" ColumnWidth="*">
	    <telerik:RadGridView.Columns>
	        <telerik:GridViewDataColumn Header="Product ID" DataMemberBinding="{Binding ProductID}" />
	        <telerik:GridViewDataColumn Header="Product name" DataMemberBinding="{Binding ProductName}" />
	        <telerik:GridViewDataColumn Header="Unit price" DataMemberBinding="{Binding UnitPrice}" DataFormatString="{}{0:C}" />
	        <telerik:GridViewDataColumn Header="Units in stock" DataMemberBinding="{Binding UnitsInStock}" />
	        <telerik:GridViewExpressionColumn Header="Total value in stock" Expression="UnitPrice * UnitsInStock" DataFormatString="{}{0:C}" />
	    </telerik:RadGridView.Columns>
	</telerik:RadGridView>

The most important property to be set is the Expression property. It can also be set in code-behind, for example, if the expression is too complex to be translated in XAML.

Example 4: Set Expression for GridViewExpressionColumn in code.

C#
	Expression<Func<Product, double>> expression = prod => prod.UnitPrice * prod.UnitsInStock;
	GridViewExpressionColumn column = this.GridView.Columns.OfType<GridViewExpressionColumn>().First();
	column.Expression = expression;

The values displayed in GridViewExpressionColumn will be updated automatically when a concerned property on the data item changes.

More information about expressions could be found here.

Not finding the help you need?
Contact Support