Reputation: 49
I am using visual studio for windows phone. Can we see the Image stored in media library in windows phone 7 emulator ? Is there any specific file location of such files?
Upvotes: 0
Views: 513
Reputation: 3529
How to: Use the Photo Chooser Task for Windows Phone
try
{
photoChooserTask.Show();
}
catch (System.InvalidOperationException ex)
{
MessageBox.Show("An error occurred.");
}
void photoChooserTask_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
MessageBox.Show(e.ChosenPhoto.Length.ToString());
//Code to display the photo on the page in an image control named myImage.
//System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
//bmp.SetSource(e.ChosenPhoto);
//myImage.Source = bmp;
}
}
Upvotes: 1
Reputation: 8126
Have you tried to get images with MediaLibrary
class? Or you want to access images outside of your application, i.e. manage images with file manager?
MediaLibrary m = new MediaLibrary();
foreach (var p in m.Pictures)
{
Debug.WriteLine(p.Name);
Stream s = p.GetImage();
}
Upvotes: 1
Reputation: 13248
If you want to select the images from image library there is a photo chooser task class
private void loadPhoto_Click(object sender, RoutedEventArgs e)
{
photoChooserTask.Show();
}
This now opens up a gallery of photos to choose from.
Upvotes: 0