我想从我的电脑上传一张图片并在网格视图中显示它。
如何从我的 PC 中选择图像并在 WASM 中列出它们?
Uno 3.6中添加了对此的官方支持。您可以使用FilePicker API在任何平台上选择文件和文件夹。
var picker = new Windows.Storage.Pickers.FileOpenPicker();
var file = await picker.PickSingleFileAsync();
if (file != null)
{
// Application now has read/write access to the picked file
this.textBlock.Text = "Picked photo: " + file.Name;
}
else
{
this.textBlock.Text = "Operation cancelled.";
}