79775136

Date: 2025-09-25 17:32:36
Score: 2
Natty:
Report link

I believe this has something to do with virtualization but I don't fully understand what's going on, why is this and how do I fix it.

Virtualization is simple: If you have 10000 strings, the UI will only create however many ListViewItem controls are needed to fit the viewport.

When you set CanContentScroll to false, the ScrollViewer will "scroll in terms of physical units", according to the documentation. That means that all 10000 ListViewItems will be created, lagging the UI.

Is there a way to keep it False so it won't show an "empty line" at the end?

By keeping it false, you kill performance. If you want to get rid of the empty line at the bottom and eliminate lag, you should override ListView's VirtualizingStackPanel in order to override it's behavior.

<ListView ScrollViewer.CanContentScroll="True">
    <ListView.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel ScrollUnit="Pixel"
                                    IsVirtualizing="True"/>
        </ItemsPanelTemplate>
    </ListView.ItemsPanel>
</ListView> 

ScrollUnit="Pixel" makes the ScrollUnit be measured in terms of pixels, which should eliminate the empty line at the bottom.

Reasons:
  • Blacklisted phrase (1): how do I
  • Blacklisted phrase (1): Is there a way
  • RegEx Blacklisted phrase (0.5): why is this
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: vmHernandes