Search code examples
c#windows-phonetitleimagemedia-library

Obtain real name of photo in windows phone 8


I can't show the real name of my photos of my picture library in windows phone 8. I have a there photos whose original names are: chucktodd-einstein-2010-1.jpg, chucktodd-einstein-2010-2.jpg,chucktodd-einstein-2010-3.jpg.

I execute this code:

MediaLibrary m = new MediaLibrary();        
for (int j = 0; j < m.Pictures.Count; j++)
{
     var r = m.Pictures[j];
     MessageBox.Show(r.Name);
}

And MessageBox show always this name : "Einstein writing on a blackboard with chalk illustration by chuck Todd 2010".

How can you Obtain the original name?


Solution

  • I found this Library and fixed this issue:

    http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.phoneextensions.medialibraryextensions.getpath(v=xnagamestudio.42).aspx

    using Microsoft.Xna.Framework.Media.PhoneExtensions;
    
    MediaLibrary m = new MediaLibrary();        
    for (int j = 0; j < m.Pictures.Count; j++)
    {
      var r = m.Pictures[j];
      MessageBox.Show(MediaLibraryExtensions.GetPath(r));
    }
    

    With this code I obtain the full path of file with the original name.