ScrollViewer不断回首

时间:2015-07-18 23:32:35

标签: .net xaml windows-phone-8.1 scrollviewer

所以我有这个包含ListView的用户控件,由ScrollViewer包装。我在DataTemplate中设置了我的布局并且它显示得很好,但是当你尝试向下滚动时,它只是快速回到顶部;它不会保持其地位。

这是xaml:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

                            <Border BorderThickness="1" BorderBrush="Black" Grid.Column="0" Grid.Row="0" 
                        Grid.RowSpan="2" Height="80" Width="80" VerticalAlignment="Top">
                                <Rectangle>
                                    <Rectangle.Fill>
                                        <ImageBrush Stretch="Fill" ImageSource="{Binding ImageUri}"/>
                                    </Rectangle.Fill>
                                </Rectangle>
                            </Border>

                            <TextBlock Grid.Column="1" Grid.Row="0" Style="{StaticResource DefaultText}" Text="{Binding Name}" FontWeight="Bold" VerticalAlignment="Top" HorizontalAlignment="Left" />
                            <TextBlock Grid.Column="1" Grid.Row="1" Style="{StaticResource DefaultText}" Text="{Binding Description}" VerticalAlignment="Top" HorizontalAlignment="Left" />
                            <TextBlock Grid.Column="2" Grid.Row="0" Style="{StaticResource DefaultText}" Grid.RowSpan="2" Text="{Binding Cost}" Width="100" FontSize="40" HorizontalAlignment="Right" />

                        </Grid>
                    </Border>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</ScrollViewer>

我看到另一篇帖子暗示问题是ScrollViewer比项目模板中的网格大。首先,这听起来很愚蠢,所以如果我只是使用scrollviewer错误,请告诉我如何解决这个问题。其次,当我接受我在文章中看到的建议(将内部网格的高度设置为大于滚动查看器的高度)时,每个列表项的高度最终都是网格的高度。 / p>

有什么建议吗?

0 个答案:

没有答案