Removing the Grid's Alternating Row Colors

ComponentOne DataGrid for Silverlight appears with alternating row colors by default. Alternating row colors are when alternate lines appear in a different color than the base color of the grid. This is helpful so that rows are easier to follow across the grid, but if you choose you can make the appearance of the grid uniform by removing the alternating row colors.

At Design Time

To remove alternating row colors and set it so all rows appear white, complete the following steps:

1.   Click the C1DataGrid control once to select it.

2.   Navigate to the Properties window and click the drop-down arrow next to the RowBackground property.

3.   Click the drop-down arrow in the box the hex code appears in, and choose White.

4.   Navigate to the Properties window and click the drop-down arrow next to the AlternatingRowBackground property.

5.   Click the drop-down arrow in the box the hex code appears in, and choose White.

In XAML

To remove alternating row colors and set it so all rows appear white, add RowBackground="White" AlternatingRowBackground="White" to the <c1:C1DataGrid> tag so that it appears similar to the following:

<c1:C1DataGrid Name="c1datagrid1" Height="180" Width="250" RowBackground="White" AlternatingRowBackground="White" />

In Code

To remove alternating row colors and set it so all rows appear white, add the following code to your project:

      Visual Basic

      C#

What You've Accomplished

Run the application and observe that all rows in the grid now appear white.

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.