Getting Started

This article will guide you through the steps needed to add a basic RadDataGrid control in your application.

1. Setting up the app

Take a look at these articles and follow the instructions to setup your app:

2. Adding the required Telerik references

You have two options:

  • Add the Telerik UI for Xamarin Nuget packages following the instructions in Telerik NuGet package server topic.

  • Add the references to Telerik assemblies manually, check the list below with the required assemblies for RadDataGrid component:

Platform Assemblies
Portable Telerik.XamarinForms.Common.dll
Telerik.XamarinForms.DataGrid.dll
Telerik.XamarinForms.SkiaSharp.dll
Android Telerik.Xamarin.Android.Common.dll
Telerik.Xamarin.Android.Data.dll
Telerik.XamarinForms.Common.dll
Telerik.XamarinForms.DataGrid.dll
Telerik.XamarinForms.SkiaSharp.dll
iOS Telerik.XamarinForms.Common.dll
Telerik.XamarinForms.DataGrid.dll
Telerik.XamarinForms.SkiaSharp.dll
UWP Telerik.XamarinForms.Common.dll
Telerik.XamarinForms.DataGrid.dll
Telerik.XamarinForms.SkiaSharp.dll

3. Adding RadDataGrid control

You could use one of the following approaches:

Drag the control from the Toolbox.

Take a look at the following topics on how to use the toolbox:

Create the control definition in XAML:

The snippet below shows a simple RadDataGrid definition:

    <telerikDataGrid:RadDataGrid x:Name="DataGrid"/>

In addition to this, you need to add the following namespace:

    xmlns:telerikDataGrid="clr-namespace:Telerik.XamarinForms.DataGrid;assembly=Telerik.XamarinForms.DataGrid"

Now that you have added the control to your view, you need to make sure that is properly loaded with the required data.

By default, the RadDataGrid control will autogenerate rows depending on the number of objects in the collection set as its ItemsSource. For the purpose of this article, we are going to use the following simple business objects:

    public class Data
    {
        public string Country { get; set; }

        public string Capital { get; set; }
    }

After you have created your collection of custom objects, you should assign it to the ItemsSource property of the control:

     this.DataGrid.ItemsSource = new List<Data>
     {
        new Data { Country = "India", Capital = "New Delhi"},
        new Data { Country = "South Africa", Capital = "Cape Town"},
        new Data { Country = "Nigeria", Capital = "Abuja" },
        new Data { Country = "Singapore", Capital = "Singapore" } 
     };

Here is the result:

datagrid-itemssource

SDK Browser and QSF applications contain different examples that show RadDataGrid's main features. You can find the applications in the Examples and QSF folders of your local Telerik UI for Xamarin installation.

See Also

In this article
Not finding the help you need? Improve this article