this code will help you...
private async void GetPicture_FromPicLib()
{
StorageFolder folder = KnownFolders.PicturesLibrary;
StorageFile file =await folder.GetFileAsync("test1.jpg");
IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);
BitmapImage img = new BitmapImage();
img.SetSource(stream);
this.imgControl.Source = img;
}
the "test1.jpg" should be your file name that you are going to access and "imgControl" should be the Name of the img control that u have in the XAML.
Remember to get permission to access pictures library.
(from Package.appxmanifest->capabilities tab->check the 'Pictures Library' from left panel)
pradeep aj
If it answers, then please vote for it.
No comments:
Post a Comment