I have a strange behaviour with VirtualizingStackPanel. I have a list with items that containst TextBlock with TextWrap="Wrap". Here is the code
<ListBox x:Name="messagesList" ItemsSource="{Binding Messages}" > <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> </Style> </ListBox.ItemContainerStyle> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <toolkit:ContextMenuService.ContextMenu> <toolkit:ContextMenu> ... </toolkit:ContextMenu> </toolkit:ContextMenuService.ContextMenu> <CheckBox Style="{Binding Own, Converter={StaticResource MsgTypeToStyle}}" Tag="{Binding TimeString}" IsEnabled="True"> <TextBlock Text="{Binding Content}" TextWrapping="Wrap"/> </CheckBox> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
It works pretty good, but if I try to scroll very fast (using mouse on emulator, not prommatically) there is some lagging in scroll, probably HorizontallOffset sometimes calculates wrong, and in the bottom in ends with very strange result (see image, right image demostrates normal behaviour).
After research i figured out that problem in combination VirtualizingStackPanel and TextBlock.TextWrap="Wrap", if i remove one element from this couple all works correctly.
But i need virtualization, because of big items count, and TextWrap for correct text displaying.
So i thing about implementing my own realisation of Virtualizing Panel, can you please guide me, how to do this?
Thanks.
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog