我正在通过功能将图像插入我的Windows应用商店:
private async void Button_Click(object sender, RoutedEventArgs e)
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Clear();
openPicker.FileTypeFilter.Add(".jpg");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
using(IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read))
{
await bitmapImage.SetSourceAsync(fileStream);
ImageBox.Source = bitmapImage;
}
}
}
我希望有一个方法可以清除ImageBox
中的图像。在Google上做了一些研究我发现使用:
ImageBox.Image = false;
我的*.image
中没有ImageBox
属性,我还能如何实现?
答案 0 :(得分:0)
评论中建议的答案有效:
ImageBox.Source = null;