If you do not want to upgrade to .NET 4.5, you can still set the IsPixelBased property based on VirtualizingStackPanel. However, this property is internal in .NET 4.0, so you will have to do this through reflection.
public static class VirtualizingStackPanelBehaviors { public static bool GetIsPixelBasedScrolling(DependencyObject obj) { return (bool)obj.GetValue(IsPixelBasedScrollingProperty); } public static void SetIsPixelBasedScrolling(DependencyObject obj, bool value) { obj.SetValue(IsPixelBasedScrollingProperty, value); }
And in your xaml:
<DataGrid> <DataGrid.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel IsItemsHost="True" local:VirtualizingStackPanelBehaviors.IsPixelBasedScrolling="True" /> </ItemsPanelTemplate> </DataGrid.ItemsPanel> </DataGrid>
source share