DataGrid for WPF and Silverlight Overview / DataGrid Features / DataGrid Appearance / Customizing Grid Appearance / Changing the Grid's Mouse Hover Style
Changing the Grid's Mouse Hover Style

By default, columns and rows that are moused over appear in a different color to indicate to users what area of the grid they are interacting with. If you choose you can customize the appearance of cells that are moused over. For example, you may want to highlight these cells even more or remove this effect.

At Design Time

To set the mouse over effect to yellow, 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 MouseOverBrush property.
  3. Click the drop-down arrow in the box the hex code appears in, and choose Yellow.

In XAML

To set the mouse over effect to yellow, add MouseOverBrush="Yellow" to the <c1:C1DataGrid> tag so that it appears similar to the following:

<c1:C1DataGrid Name="c1datagrid1" Height="180" Width="250" MouseOverBrush="Yellow" />

In Code

To set the mouse over effect to yellow, add the following code to your project:

Visual Basic
Copy Code
Me.c1datagrid1.MouseOverBrush = New System.Windows.Media.SolidColorBrush(Colors.Yellow)

 

C#
Copy Code
this.c1datagrid1.MouseOverBrush = new System.Windows.Media.SolidColorBrush(Colors.Yellow);

 

What You've Accomplished

Run the application and observe that all highlighted rows and columns in the grid now appear yellow.