I need to show all photo present in a my device (WP8) in a LongListMultiSelector. i use this method
MediaPlayer.Queue.ToString();
MediaLibrary mediaLibrary;
PictureAlbum cameraRoll = null;
foreach (MediaSource source in MediaSource.GetAvailableMediaSources())
{
if (source.MediaSourceType == MediaSourceType.LocalDevice)
{
mediaLibrary = new MediaLibrary(source);
PictureAlbumCollection allAlbums = mediaLibrary.RootPictureAlbum.Albums;
foreach (PictureAlbum album in allAlbums)
{
if (album.Name == "Camera Roll")
{
cameraRoll = album;
}
}
}
}
List<BitmapImage> lstBitmapImage = new List<BitmapImage>();
foreach (Picture p in cameraRoll.Pictures)
{
BitmapImage b = new BitmapImage();
b.SetSource(p.GetThumbnail());
lstBitmapImage.Add(b);
}
PhotoHubLLS.ItemsSource = lstBitmapImage;
In a XAML i have this image setting
<Image HorizontalAlignment="Left" Margin="6,6,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Source="{Binding}"/>
It all works perfectly, but I have some questions.
I would like to Zoom on single picture, on image tap i'm insert this code
FrameworkElement fe = sender as FrameworkElement;
if (fe != null)
{
CurrentPicture = fe.DataContext as Picture;
}
but is null a datacontext because I used "Source".
how can I do?