I have a ListBox WPF with some custom maps inside.
When one of these user cards is created (ideally, when the current user receives a list of friends from the network), he makes a network request for user information.
When I browse the ListBox, wait a few seconds and scroll back, custom maps have a default state.
After debugging, I noticed that they were unloaded and recreated.
How can I stop a ListBox from virtualizing such items?
Code:
<ListBox x:Name="friend_list" Background="{x:Null}" BorderBrush="{x:Null}"> <ListBox.ItemTemplate> <DataTemplate DataType="data:User"> <stuff:UserCard UserID="{Binding Path=UserID}" HorizontalAlignment="Stretch" Margin="0,0,0,0" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
source share