我在textblock内有一个scrollviewer元素的页面。文本块绑定到一个字符串,该字符串最多可附加800行。我注意到滚动和绑定更新的性能明显不好; 2 - 3秒。
如何在保持相同操作的同时优化此方案? (滚动绑定文本)
<ScrollViewer Name="resultsScrollView"
Grid.Row="1"
IsDeferredScrollingEnabled="True"
CanContentScroll="True"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.VirtualizationMode="Recycling"
SnapsToDevicePixels="False">
<TextBlock Text="{Binding Path=Results,
UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style>
<Setter Property="TextBlock.Background" Value="#2f323b"></Setter>
<Setter Property="TextBlock.Foreground" Value="White"></Setter>
<Setter Property="TextBlock.FontFamily" Value="Roboto"></Setter>
</Style>
</TextBlock.Style>
</TextBlock>
</ScrollViewer>