C# SaveImagePropertiesAsync()不';无法保存更改

C# SaveImagePropertiesAsync()不';无法保存更改,c#,uwp,windows-10-universal,windows-10-mobile,C#,Uwp,Windows 10 Universal,Windows 10 Mobile,我正在尝试将一些属性保存到移动电话上Windows10UWP应用程序的图像文件中 var fileProperties = await file.Properties.GetImagePropertiesAsync(); fileProperties.Rating = 25; fileProperties.Title = "Title"; fileProperties.DateTaken = DateTime.Now; await file.Properties.SaveProperties

我正在尝试将一些属性保存到移动电话上Windows10UWP应用程序的图像文件中

var fileProperties = await file.Properties.GetImagePropertiesAsync();

fileProperties.Rating = 25;
fileProperties.Title = "Title";
fileProperties.DateTaken = DateTime.Now;

await file.Properties.SavePropertiesAsync();
由于某些原因,不会保存属性

文件是这样预先创建的:

var file = await _sourceFolder.CreateFileAsync(pathToFile, CreationCollisionOption.ReplaceExisting);
await bitmap.SaveToStorageFile(file);
其中位图的类型为WriteableBitmap。 图像将保存到文件中,但不显示属性


有人知道我做得不对吗?没有例外,也没有关于失败原因的消息。

这里的问题是
StorageFile.Properties.SavePropertiesAsync
,它获取StorageItemContentProperties。它使用原始数据保存到文件中

您应该能够使用
ImageProperties.SavePropertiesAsync
方法。它使用新的ImageProperties数据保存到文件中

例如:

var fileProperties = await file.Properties.GetImagePropertiesAsync();
fileProperties.Rating = 25;
fileProperties.Title = "title";
fileProperties.DateTaken = DateTime.Now;
await fileProperties.SavePropertiesAsync();

哦,我的错,那么。。。谢谢你的帮助。把你的答案标记为“一”。它起作用了。