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:
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!
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!
