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

Numerical Column

The DataGridNumericalColumn represents only numerical values.

The following example shows how to generate a DataGridNumericalColumn.

  1. First, create the business object.

    Create the Data Model

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

    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} 
            }; 
        }    
    
  3. The final step is to bind the ItemsSource property of the DataGrid and manually declare the DataGridNumericalColumn column. To associate each column with the relevant property from the model, the example uses the PropertyName property.

    Define PropertyName 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> 
    
    Numerical Column

WinUI DataGrid Numerical Column

In this article
Not finding the help you need?