Version

We recommend that you use the xamDataGrid control instead of the xamGrid control. The xamGrid is being planned for retirement over the next few years and will not receive any new features. We will continue to provide support and critical bug fixes for the xamGrid during this time. For help or questions on migrating your codebase to the xamDataGrid, please contact support.

ItemTemplate Binding

You can add content to the column by setting the ItemTemplate property to an instance of a data template. The UnboundDataContext object contains the following properties:

  • Value – this is the value returned from the ValueConverter

  • ColumnKey – this is the column key of the unbound column

  • RowData – the data object that the current row represents would represent

The following code demonstrates how to display data in an unbound column using ItemBinding.

In XAML:

<ig:UnboundColumn Key="Total Units" ValueConverter="{StaticResource TotalUnitsConverter}">
   <ig:UnboundColumn.ItemTemplate>
      <DataTemplate>
         <StackPanel>
            <TextBlock Text="{Binding Value}" />
            <TextBlock Text="{Binding ColumnKey}" />
            <TextBlock Text="{Binding RowData.ProductID}" />
         </StackPanel>
      </DataTemplate>
   </ig:UnboundColumn.ItemTemplate>
</ig:UnboundColumn>

Related Topics