Version

Supplying Data

You can supply data to the xamDataGrid™, xamTreeGrid™, xamDataCards™, xamDataCarousel™, or xamDataPresenter™ control by either:

  • setting or binding to the DataSource property; or

  • adding items directly to the DataItems collection through code or through XAML, as shown below.

The DataSource property can be set to any object that implements the System.Collections.IEnumerable interface (other than a string), as shown in the XAML below.

<igDP:XamDataGrid DataSource="{Binding Source={StaticResource MyData}}" />

The DataItems collection is marked as the "Content" property, so you don’t need to specify it explicitly in XAML. Any enclosed objects will automatically get added to this collection, as shown in the XAML below.

<igDP:XamDataGrid>
        <MYCustomer ... />
        <MYCustomer ... />
        <MYCustomer ... />
        <MYCustomer ... />
</igDP:XamDataGrid>
Note
Note

Setting the DataSource property and adding items to the DataItems collection of the same control is not supported and will cause an exception to be thrown.