New to Telerik UI for WPF? Download free 30-day trial

Alternation

RadVirtualGrid allows alternating its rows and columns when readability needs to be improved. This article covers the mechanism in details.

Row Alternation

The row alternation of the control can be utilized through the RowAlternationCount property.

Example 1: Setting the RowAlternationCount

<telerik:RadVirtualGrid x:Name="VirtualGrid"  
                            InitialColumnCount="4"  
                            InitialRowCount="4" 
                            RowAlternationCount="2"/> 

Figure 1: Setting the RowAlternationCount property

Setting the RowAlternationCount property

Column Alternation

Respectively, the alternation of the columns of RadVirtualGrid can be manipulated through the ColumnAlternationCount property of the control.

Example 2: Setting the ColumnAlternationCount

<telerik:RadVirtualGrid x:Name="VirtualGrid"  
                            InitialColumnCount="4"  
                            InitialRowCount="4" 
                            ColumnAlternationCount="2"/> 

Figure 2: Setting the ColumnAlternationCount property

Setting the ColumnAlternationCount property

Custom Alternation color

RadVirtualGrid exposes a property for altering the default background applied to the elements participating in the alternation: AlternationBrush.

Example 3: Setting the AlternationBrush

    <telerik:RadVirtualGrid x:Name="VirtualGrid"  
                            InitialColumnCount="4"  
                            InitialRowCount="4" 
                            RowAlternationCount="2" 
                            ColumnAlternationCount="2" 
                            AlternationBrush="Beige"/> 

Figure 3: Setting the AlternationBrush property

Setting the ColumnAlternationCount property

See Also

In this article