We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Change mouseover row color

Thread ID:





127462 Nov 16,2016 08:27 PM UTC Nov 17,2016 01:58 PM UTC WPF 1
Tags: SfDataGrid
Alan L
Asked On November 16, 2016 08:27 PM UTC

I was able to apply a column header style with MouseOver VisualState to change the column header color on MouseOver , but unable to do the same for changing a row's mouseover color.  My attempt resulted in rows being solid color rectangles displaying no data and no MouseOver behavior.

Would you have a style snippet for changing a row's MouseOver color?


Srinivasan Vasu [Syncfusion]
Replied On November 17, 2016 01:58 PM UTC

Hi Alan, 
Thanks for contacting Syncfusion support. 
You can achieve your requirement by overriding VirtualizingCellsControl. Please refer the below code example. 
Code Example 
  public class RowStyles : VirtualizingCellsControl 
        public StyleViruatl() :base() 
        protected override void OnMouseEnter(System.Windows.Input.MouseEventArgs e) 
           if (!String.IsNullOrEmpty((this.DataContext as MyClass).Column1.ToString())) 
               this.RowHoverBackgroundBrush = new SolidColorBrush(Colors.Red); 
               this.RowHoverBackgroundBrush = new SolidColorBrush(Colors.White); 
        protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e) 
            this.RowHoverBackgroundBrush = new SolidColorBrush(Colors.White); 
    public class CustomRowGenerator : RowGenerator 
        public CustomRowGenerator(SfDataGrid dataGrid) 
            : base(dataGrid) 
        protected override VirtualizingCellsControl GetVirtualizingCellsControl<T>() 
            //Set the customized VirtualizingCellsControl 
            if (typeof(T) == typeof(VirtualizingCellsControl)) 
                return new RowStyles(); 
            return base.GetVirtualizingCellsControl<T>(); 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon