Version 24.2 (latest)

Adding xamDataGrid to Your Page

This topic is designed to get you up and running as quickly as possible by describing the basic steps required for adding the xamDataGrid™ control.

  1. Create a Microsoft® Windows® Presentation Foundation Window project.

  1. Add the following NuGet package to your application:

    • Infragistics.WPF.DataGrids

For more information on setting up the NuGet feed and adding NuGet packages, you can take a look at the following documentation: NuGet Feeds.

  1. Add a namespace declaration for xamDataGrid.

    In XAML:

    xmlns:igDP="http://infragistics.com/DataPresenter"

    In Visual Basic:

    Imports Infragistics.Windows.DataPresenter

    In C#:

    using Infragistics.Windows.DataPresenter;
  1. Name the default Grid layout panel in the Window so that you can reference it in the code-behind.

    In XAML:

    <Grid Name="layoutRoot">
    </Grid>
  1. Attach an event handler to the Window’s Loaded event if you are going to add the xamGrid using code-behind.

    In XAML:

    <Window ... Loaded="Window_Loaded" ... >
  1. Create an instance of xamDataGrid. Set the BindToSampleData property to True. This will automatically populate xamDataGrid with sample data so that you can preview the xamDataGrid control without setting up a data source. Add the xamDatgrid in the main grid.

    In XAML:

    <igDP:XamDataGrid Name="xamDataGrid1" BindToSampleData="True" />

    In Visual Basic:

    Private xamDataGrid1 as XamDataGrid
    xamDataGrid1 = New XamDataGrid()
    ' You can data bind your instance of xamDataGrid
    ' instead of using the built in sample data
    xamDataGrid1.BindToSampleData = True
    Me.layoutRoot.Children.Add(xamDataGrid1)

    In C#:

    private XamDataGrid xamDataGrid1;
    xamDataGrid1 = new XamDataGrid();
    // You can data bind your instance of xamDataGrid
    // instead of using the built in sample data
    xamDataGrid1.BindToSampleData = true;
    this.layoutRoot.Children.Add(xamDataGrid1);
  1. Run the project to see the xamDataGrid control populated with sample data.

    creating xamdatagrid in xaml