簡體   English   中英

從Windows Store應用清除圖像

[英]Clear image from windows store app

我正在按功能將圖像插入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 ,怎么回事我可以實現?

評論中建議的答案有效:

ImageBox.Source = null;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM