We investigated this scenario and it turns out that this behavior can occur when UIElement.IsMouseOver property is not cleared for recycled GridViewRow containers. Note, that when the UI virtualization of the RadGridView is enabled the control reuses already created GridViewRows, which helps improve the peformance. That said, it seems that when the UI thread is busy the IsMouseOver property can remain true when a container is recycled and subsequently reused, which leads to the GridViewRow entering its MouseOver state. As we do not have control over the UIElement.IsMouseOver property value, we will proceed with switching the state of this item to "Won't fix".
In order to manually update the IsMouseOver value of recycled rows, you can override the ClearContainerForItemOverride of the RadGridView and use reflection:
public class CustomRadGridView : RadGridView
{
private MethodInfo? writeFlagMethodInfo = null;
private object isMouseOverCacheFlag = null;
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
{
base.ClearContainerForItemOverride(element, item);
var gridViewRow = element as GridViewRow;
if (gridViewRow != null && gridViewRow.IsMouseOver)
{
this.ClearRowIsMouseOverCache(gridViewRow);
}
}
private void ClearRowIsMouseOverCache(GridViewRow row)
{
try
{
if (this.writeFlagMethodInfo == null)
{
this.writeFlagMethodInfo = row.GetType().GetMethod("WriteFlag", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
var coreFlags = typeof(UIElement).Assembly.GetType("System.Windows.CoreFlags");
this.isMouseOverCacheFlag = coreFlags.GetField("IsMouseOverCache").GetValue(coreFlags);
}
this.writeFlagMethodInfo.Invoke(row, new object[] { this.isMouseOverCacheFlag, false });
}
catch (Exception)
{
}
}
}
Regards,
Vladimir Stoyanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.