locked
Freeing item memory as you scroll past them in GridView/ListView?

    Question

  • void ListOfItems::OnContainerContentChanging(ListViewBase ^sender, ContainerContentChangingEventArgs ^e)
    {
    	int i = e->ItemIndex;
    	if (e->InRecycleQueue)
    	{
    		Unload(i);
    	}
    	else
    	{
    		Load(i);
    	}		
    }

    The above is what I have to load a large list of thumbnails incrementally as you scroll through a gridview. The incremental loading works but e->InRecycleQueue is never true. So when I have a large list and I scroll through them all the app eventually runs out of memory. So I think I am not using this correctly. I am using a GridView with ItemsStackPanel as the ItemsPanelTemplate.

    How do you correctly release memory as you scroll past an item in the grid view?

    Monday, March 09, 2015 6:15 AM

Answers