2011-11-23 128 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

感謝您的回覆。目前我已經離開了城市,只能再次檢查一次。再次感謝 –