2011-11-23 74 views
0

我在SilverLight和Windows Phone编程中很新。我正在研究一个Twitter应用程序。在时间轴视图中 - 当我单击刷新应用程序时,将获取Twitter提要数据并在已有的提要上进行更新。我将所有较早的Feed都保存在独立存储中。更新后保留位置Listbox的StackPanels

现在我的问题是,每当我刷新饲料列表框位置到顶部。我如何保持滚动更早的位置?我在SilverLight和Windows Phone中是全新的。

<ListBox ItemsSource="{Binding feeds}" Margin="0,10,0,0"> 
    <ListBox.ItemTemplate> 
    <DataTemplate> 
     <StackPanel> 
     <TextBlock Text="{Binding FeedText}" Style="{StaticResource PhoneTextNormalStyle}" /> 
     <TextBlock Text="{Binding FeedDate}" Style="{StaticResource PhoneTextNormalStyle}" /> 
     </StackPanel> 
    </DataTemplate> 
    </ListBox.ItemTemplate> 
</ListBox> 

回答

0

这个问题可能对你有一个答案:Restore Scroll Position in LongListSelector after tombstone

这个问题可能是使用过:Restoring exact scroll position of a listbox in Windows Phone 7

在很大程度上取决于您所加载的方式/刷新数据(替换所有或更新项目)。在某些情况下,您需要滚动到不同的位置,因为在其他场景中内容已更改(或项目的顺序),您将希望保持相对位置。

确保你从功能的角度知道你想要发生什么。

+0

感谢您的回复。目前我已经离开了城市,只能再次检查一次。再次感谢 –