becool_max
becool_max

Reputation: 121

how to override image in media library in WP7

I want to save image to media library in windows phone 7. I`m using this example http://msdn.microsoft.com/en-us/library/ff769549(v=VS.92).aspx . It works fine, the only problem that i have is that after image modification i call save procedure with the same file name, exactly like in example

MediaLibrary library = new MediaLibrary();
Picture pic = library.SavePicture("SavedPicture.jpg", myFileStream);
myFileStream.Close();

but modification is saved to another file, even thought i use the same file name when i call SavePicture (and i want to override the image file). What am i doing wrong?

Upvotes: 2

Views: 846

Answers (2)

Matt Lacey
Matt Lacey

Reputation: 65564

You can't.

It's only possible to read and add images in/to the MediaLibrary.
It is not possible to edit or delete images.

This is by design.

Upvotes: 1

AnthonyWJones
AnthonyWJones

Reputation: 189457

Reading between the lines a little you are seeing a new picture appear in the phone saved pictures collection where you were expecting an existing one to be replaced?

You should note that the code you have referenced creates duplicate pictures. One is stored in the phones saved pictures collection and another is saved in isolated storage for the application.

Its not possible for an application to mutate an existing picture in the saved pictures collection even if that application is the original creator of the picture. When saved, a new picture is created in the saved pictures collection.

On the other hand the existing content of the file in the isolated storage is replaced with the new content.

Upvotes: 1

Related Questions