Open zhanggaolei001 opened 3 months ago
Ok, I have handled the PreviewMouseWheel event to implement this functionality temporarily
private void PropertyGrid_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
var sc = FindParentScrollViewer(this);
if (sc != null)
{
sc.ScrollToVerticalOffset(sc.VerticalOffset - e.Delta);
}
e.Handled = true;
}
public ScrollViewer FindParentScrollViewer(DependencyObject child)
{
if (child == null) return null;
while (child != null && !(child is ScrollViewer))
{
child = VisualTreeHelper.GetParent(child);
}
return child as ScrollViewer;
}
Is there any way better?
Stale issue message
Here is the demo code:
In my project, the view model and the view are more complicated, but they have the same problem. I can scroll vertically with the mouse wheel in the Ellipse or empty space, but the PropertyGrid zone does not work.How can I make the PropertyGrid control respond to mouse wheel scrolling?