在Surface(WinRT)上滚动列表视图时性能不佳

时间:2013-03-14 13:01:28

标签: xaml listview scroll windows-rt

我们有一个列表视图,其中包含一些包含一些文本和一些图像的项目。垂直滚动时,Surface RT上的性能非常糟糕。如果你以适中的速度滚动,它们都会有点不稳定的滚动并显示黑名单。在Windows 8机器上运行没问题。 ¨

我在这里做错了什么或者是否有更好的性能的第三方列表视图?

以下是该问题的视频: https://dl.dropbox.com/u/25670071/scrolling.MOV

这是ListView的XAML:

<ListView HorizontalAlignment="Stretch"
          VerticalAlignment="Top"                                                
          VirtualizingStackPanel.VirtualizationMode="Recycling"
          Grid.Row="1"
          ItemsSource="{Binding Matches}"
          ItemContainerStyle="{StaticResource ListViewItemStyleInternal}"
          ItemsPanel="{StaticResource ItemsPanelTemplate1}"
          SelectionMode="None"
          IsItemClickEnabled="True"
          ItemClick="OnMatchItemClick">
    <ListView.Template>
        <ControlTemplate>
            <ItemsPresenter />
        </ControlTemplate>
    </ListView.Template>

    <ListView.ItemTemplate>
        <DataTemplate>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="70"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition MinWidth="80"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition MinWidth="70"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Border Grid.ColumnSpan="6" 
                        Background="#FF4D4D4D" 
                        Opacity=".7" 
                        Visibility="{Binding IsOdd, Converter={StaticResource BooleanToVisibilityConverterInverted}}" />

                <TextBlock Text="{Binding HomeTeamName}" 
                            TextAlignment="Right" 
                            TextWrapping="Wrap" 
                            VerticalAlignment="Center" 
                            FontSize="12" 
                            Foreground="#FFF2F2F2" 
                            Margin="10,0,0,0"/>
                <Image Source="{Binding HomeTeamLogo}" 
                        Grid.Column="1" 
                        Width="30" 
                        Stretch="Uniform" 
                        Margin="10,0"/>
                <Image Source="{Binding AwayTeamLogo}"
                        Grid.Column="3" 
                        Width="30" 
                        Stretch="Uniform"
                        Margin="10,0"/>
                <TextBlock Text="{Binding AwayTeamName}" 
                            Grid.Column="4" 
                            TextWrapping="Wrap" 
                            VerticalAlignment="Center" 
                            FontSize="12" 
                            Foreground="#FFF2F2F2" 
                            Margin="0,0,10,0"/>
                <Path Data="F1M987.6631,396.0728C987.1801,396.0728,986.7871,395.6648,986.7871,395.1648C986.7871,394.6638,987.1801,394.8628,987.6631,394.8628C988.1461,394.8628,988.5391,395.2678,988.5391,395.7698C988.5391,396.2708,988.1461,396.0728,987.6631,396.0728 M982.4051,391.1748L980.0681,390.3298L980.6521,385.7948L982.9901,386.8058z M989.4161,393.0478C988.2491,391.8398,987.3711,392.4438,987.0781,391.8398C986.7871,391.2348,987.2211,389.3358,986.7871,388.2138C986.2021,386.7018,985.0341,386.0968,985.0341,386.0968C980.9441,384.2828,967.7991,379.4468,967.2151,380.0518C966.9221,380.3538,965.7541,381.8648,966.0471,385.7948C966.0471,385.7948,973.7891,390.3338,974.9601,391.3818C976.2711,391.8398,974.6401,393.8548,975.1021,395.7698C975.6741,398.1338,978.6061,399.9998,980.9441,399.9998C983.2801,399.9998,986.2021,398.7918,986.2021,396.9768C986.2021,395.1648,985.6191,396.9768,985.9091,397.2798C986.2021,397.5808,987.6291,397.7448,988.5391,397.5808C990.0451,397.3128,990.0001,394.5598,990.0001,394.2578C990.0001,393.9558,989.7071,393.3508,989.4161,393.0478"
                        Grid.Column="5" 
                        Fill="Gray" 
                        Height="20" 
                        Stretch="Fill" 
                        VerticalAlignment="Center" 
                        Width="24"
                        Margin="16,0"/>

                <Grid Grid.Column="2" 
                        VerticalAlignment="Center" 
                        Margin="0" 
                        Visibility="{Binding IsStarted, Converter={StaticResource BooleanToVisibilityConverter}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <TextBlock FontWeight="SemiBold" 
                                HorizontalAlignment="Right" 
                                Text="{Binding HomeTeamScore}" 
                                VerticalAlignment="Top"
                                Foreground="White" 
                                TextAlignment="Center" 
                                FontSize="40" 
                                Width="30"/>
                    <TextBlock Grid.Column="1" 
                                FontWeight="SemiBold" 
                                FontSize="40" 
                                HorizontalAlignment="Center" 
                                TextWrapping="Wrap" 
                                Text="-" 
                                VerticalAlignment="Top" 
                                Foreground="White"/>
                    <TextBlock Grid.Column="2" 
                                FontWeight="SemiBold" 
                                FontSize="40" 
                                HorizontalAlignment="Left"
                                Text="{Binding AwayTeamScore}" 
                                VerticalAlignment="Top"
                                Foreground="White" 
                                TextAlignment="Center" 
                                Width="30"/>
                </Grid>
                <Grid Grid.Column="2" 
                        VerticalAlignment="Center" 
                        Margin="0" 
                        Visibility="{Binding IsStarted, Converter={StaticResource BooleanToVisibilityConverterInverted}}">
                    <StackPanel HorizontalAlignment="Center" 
                                VerticalAlignment="Center">
                        <TextBlock Foreground="#FFCCCCCC" 
                                    FontSize="14" 
                                    HorizontalAlignment="Center" 
                                    FontFamily="Segoe" 
                                    FontWeight="SemiBold" 
                                    Text="Kick-off"/>
                        <TextBlock Foreground="#FFCCCCCC" 
                                    FontSize="16" 
                                    HorizontalAlignment="Center" 
                                    VerticalAlignment="Center" 
                                    FontFamily="Segoe" 
                                    FontWeight="Normal" 
                                    Text="{Binding MatchStartTime}"/>
                    </StackPanel>
                </Grid>
            </Grid>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

0 个答案:

没有答案