ItemContainerStyle Property
See Also  Example
Xceed.Wpf.DataGrid Assembly > Xceed.Wpf.DataGrid Namespace > DetailConfiguration Class : ItemContainerStyle Property

Gets or sets the style that will be applied to the containers (DataRow) of the data items in the details to which the configuration is applied.

Syntax

Visual Basic (Declaration) 
Public Property ItemContainerStyle As Style
C# 
public Style ItemContainerStyle {get; set;}

Return Value

The Style that will be applied to the containers (DataRow) of the data items in the details to which the configuration is applied.

Example

All examples in this topic assume that the grid is bound to the Employees table of the Northwind database, unless stated otherwise.
The following example demonstrates how to provide an item-container style for the Employee_Orders data relation.
XAMLCopy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid" 
      xmlns:local="clr-namespace:Xceed.Wpf.Documentation"> 
  <Grid.Resources> 
    <xcdg:DataGridCollectionViewSource x:Key="cvs_employees" 
                                    Source="{Binding Source={x:Static Application.Current}, 
                                              Path=Employees}"/>            
    
    <xcdg:IndexToOddConverter x:Key="rowIndexConverter" /> 
    
    <Style x:Key="alternatingDataRowStyle" TargetType="{x:Type xcdg:DataRow}"> 
      <Style.Triggers> 
         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, 
                                 Path=(xcdg:DataGridVirtualizingPanel.ItemIndex), 
                                 Converter={StaticResource rowIndexConverter}}" 
                      Value="True"> 
            <Setter Property="Background" Value="AliceBlue"/>                     
         </DataTrigger> 
      </Style.Triggers> 
    </Style> 
  </Grid.Resources> 
  
  <xcdg:DataGridControl x:Name="EmployeesGrid" 
                  ItemsSource="{Binding Source={StaticResource cvs_employees}}" 
                  AutoCreateDetailConfigurations="True">    
 
    <xcdg:DataGridControl.DetailConfigurations> 
      <xcdg:DetailConfiguration RelationName="Employee_Orders" 
                                Title="Employee Orders" 
                                ItemContainerStyle="{StaticResource alternatingDataRowStyle}"/>                         
    </xcdg:DataGridControl.DetailConfigurations>       
  </xcdg:DataGridControl> 
</Grid> 

Remarks

Changes made to the item-container style will only be applied when the detail configuration is reapplied (i.e., when a detail is re-expanded).

Notes

Changes made to the ItemContainerStyle or ItemContainerStyleSelector properties will not be reflected on existing containers (items that are visible in the viewport) until their containers are recreated or the grid is refreshed. Items that were not visible when the new style or selector were set will use the new style.

Requirements

Supported Frameworks: Microsoft .NET Framework version 3.5

See Also