[Solved] DataGrid MouseHoverStyle. Request for Style selector.

1 Answer 12 Views
DataGrid
Wojtek
Top achievements
Rank 1
Wojtek asked on 13 Jul 2026, 08:34 PM | edited on 13 Jul 2026, 08:35 PM
Hi,

I was required to change hover color of whole row based on some information. I've noticed that background has a selector wheras mousehoverstyle doesn't.

I managed to get it done by doing something like this:

        grid.VisualStateService.PropertyChanged += (s, e) =>
        {
            if (e.PropertyName != nameof(grid.VisualStateService.MouseHoverCell))
                return;

            var cell = grid.VisualStateService.MouseHoverCell;
            var model = cell?.Item as SomeModel;

            grid.MouseHoverStyle = new Style(typeof(DataGridMouseHoverAppearance))
            {
                Setters =
                {
                    new Setter
                    {
                        Property = DataGridBorderAppearance.BackgroundColorProperty,
                        Value = model.HasFutureAppointments || model.SomeOtherProperty.HasFutureAppointments 
                            ? Colors.Blue
                            : Colors.Red
                    }
                }
            };
        };

I feel like it's a bit hacky. I'd appreciate proper selector for this. I think that's a good addition for DataGrid customization :). Furthermore if there's a better way to do this, please correct me!

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 16 Jul 2026, 01:08 PM

Hello Wojtek,

I agree having a style selector is a valid request, so I have logged it on your behalf here https://feedback.telerik.com/maui/1716853-datagrid-request-for-mousehover-style-selector and updated your Telerik points for this suggestion on improving the DataGrid control. 

For now the approach you found is an option you can use to apply conditional styling on mouse hover. Thank you for sharing it in the forum.

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DataGrid
Asked by
Wojtek
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or