I am working on an app that gets bbcode from a website, converts it to the appropriate UIElements and then adds it to a wrap panel via a dependency property which is in a LongListSelector. All of that code works fine, however when the bbcode contains a lot of images or is just very long I have something weird happen. When you scroll about halfway down the large item it gets unrealized and disappears from the screen and never comes back. The rest of the items in the list show fine, but if you scroll up or down to where the large item is, it never shows. I have tried adding my wrappanel to a stackpanel and it shows properly. I have also taken my wrappanel property and just had it add a bunch of textblocks and that also skips past the long one about half way down. Here is my test code for the LLS and the WrapPanel
XAML
WrapPanel Properties
Is there any way to stop my larger items from being unrealized?
XAML
<Grid x:Name="ContentPanel" Grid.Row="2" Margin="12,0,12,0"> <phone:LongListSelector x:Name="MainLongListSelector" Margin="0,0,-12,0" ItemsSource="{Binding PostList}"> <phone:LongListSelector.ItemTemplate> <DataTemplate> <toolkit:WrapPanel wrapx:Properties.BBCode="{Binding PostContent}"/> </DataTemplate> </phone:LongListSelector.ItemTemplate> </phone:LongListSelector> </Grid>
WrapPanel Properties
public class Properties : DependencyObject { public static readonly DependencyProperty BBCodeProperty = DependencyProperty.RegisterAttached("BBCode", typeof(string), typeof(Properties), new PropertyMetadata(null, BBCodeChanged)); public static void SetBBCode(DependencyObject obj, string value) { obj.SetValue(BBCodeProperty, value); } public static string GetBBCode(DependencyObject obj) { return (string)obj.GetValue(BBCodeProperty); } private static void BBCodeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { WrapPanel panel = d as WrapPanel; if (panel == null) return; panel.Children.Clear(); for (int i=0; i<3000; i++) { TextBlock t = new TextBlock(); t.Width = 500; t.Text = i.toString(); panel.Children.Add(t); } }
Is there any way to stop my larger items from being unrealized?