New to Telerik UI for WinUI? Download free 30-day trial

Numerical Column

The DataGridNumericalColumn is used to represent only numerical values.

Example

This tutorial will show you how to generate DataGridNumericalColumn. First we need to create our business object.

Example 1: Create Data model

public class Data 
{ 
    public string Product { get; set; } 
    public int Amount { get; set; } 
} 
The next step is to create sample data.

Example 2: Create Sample Data

public MainPage() 
{ 
    this.InitializeComponent(); 
    this.DataContext = new List<Data>() 
    { 
        new Data { Product = "Jacket",  Amount = 5}, 
        new Data { Product = "Jeans",   Amount = 3}, 
        new Data { Product = "T-Shirt", Amount = 5}, 
        new Data { Product = "Socks",   Amount = 10} 
    }; 
}    
The final step is to bind the ItemsSource property of the RadDataGrid and manually declare DataGridNumericalColumn column. We have used the PropertyName property to associate each column with the relevant property from our model.

Example 3: Defining in XAML

<telerikGrid:RadDataGrid UserEditMode="Inline" ItemsSource="{Binding}" AutoGenerateColumns="False" Height="250" Width="300"> 
    <telerikGrid:RadDataGrid.Columns> 
        <telerikGrid:DataGridTextColumn PropertyName="Product" Header="Product"/> 
        <telerikGrid:DataGridNumericalColumn PropertyName="Amount" Header="Amount"/> 
    </telerikGrid:RadDataGrid.Columns> 
</telerikGrid:RadDataGrid> 

Figure 1: Numerical Column

DataGrid Numerical Column

In this article
Not finding the help you need?