Reputation: 1153
I'm using a Pivot to display a dynamic amount of pivot items. The following code is a simplified version of what I'm doing.
//.xaml
<Pivot Name="PivotImages">
<Pivot.ItemTemplate>
<DataTemplate>
<Image Name="ImageFull" Source="{Binding PhotoUrl}" />
</DataTemplate>
</Pivot.ItemTemplate>
</Pivot>
//.xaml.cs
private readonly ObservableCollection<PhotoPageViewModel> _photoPageViewModelList = new ObservableCollection<PhotoPageViewModel>();
PivotImages.ItemsSource = _photoPageViewModelList;
//PhotoPageViewModel.cs
private string _photoUrl;
public string PhotoUrl
{
get { return _photoUrl; }
set
{
_photoUrl = value;
OnPropertyChanged("PhotoUrl");
}
}
I add new items with
_photoPageViewModelList.Add(new PhotoPageViewModel());
where PhotoUrl
is initialized in the constructor. The model seems to work as desired. Problem is that ImageFull
loads the image from the web when the new pivot item is selected.
What i would like to achieve is that the image loads when the new pivot item is added and not when it's the selected pivot item. So when you swipe to the next pivot item, you should already see the loaded image.
Edit: I realized that i might be using the wrong Element to solve my problem. A Pivot only shows the new Item when the swipe animation is completed. What i would like to have, is a visible pivot item right next to the current one. Just like in the Photo App, where you can see the next photo as soon as you start swiping left or right.
Upvotes: 0
Views: 97