Hello,
I have a really strange issue with a ListBox scrolling. When scrolling fast, or more times random entries are being inserted at the ends of the list. I have tried to set the virtualization mode to recylcing (to enable cache). I have taken a video of the error: http://www.youtube.com/watch?v=qSRi30P3loM
Here is the XAML Code:
Here is the C# part where I fill the list:Code:<ListBox VirtualizingStackPanel.VirtualizationMode="Recycling" Height="573" HorizontalAlignment="Left" Name="listBox" VerticalAlignment="Top" Width="456" DataContext="{Binding}" ItemsSource="{Binding}" Margin="0,-22,0,0" Grid.ColumnSpan="2"> <ListBox.ItemTemplate> <DataTemplate> <Grid> <TextBlock Text="{Binding Name}" FontSize="38" /> <TextBlock Text="{Binding Group}" FontSize="22" Margin="10,42,-10,-30" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox>DecodeFrom64 is a string to string function where I decode a base64 encoded string.Code:byte[] xmlByteArray = Encoding.UTF8.GetBytes(xml); MemoryStream xmlStream = new MemoryStream(xmlByteArray); XDocument loadedData; if (xmlStream != null) { loadedData = XDocument.Load(xmlStream); } else { MessageBox.Show("Something went wrong, sorry"); return 0; } var data = from query in loadedData.Descendants() select new EwalletList { Name = DecodeFrom64((string)query.Element("name")), Value = DecodeFrom64((string)query.Element("value")), Group = DecodeFrom64((string)query.Element("group")) }; listBox.ItemsSource = data; return 1;
I would appreciate any help,
Thanks,
Bálint

Reply With Quote




