Note that there are some explanatory texts on larger screens.

plurals
  1. POImage in GridViewItem on previous Page blocking file access
    primarykey
    data
    text
    <p>I have a Page <strong>Ingredients.xaml</strong> with a GridView. This GridView displays a list of <code>Ingredient</code> objects. For each item, an image is displayed by binding to a string property of the <code>Ingredient</code> object containing the file's path (in the app's local folder). </p> <p>When I click on an item, the app navigates to <strong>Ingredient.xaml</strong>, a details page, where the image as well as all the details are displayed. There is functionality to set a new image or replace/remove the current one. </p> <p>When there is no image yet, everything works like a charm. However, as soon as a file exists already, I get the following error when trying to either delete or replace the current file: "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))". </p> <p>At first I thought the Image in <strong>Ingredient.xaml</strong> was the issue, since it was still showing the image I was trying to delete. So i added the following line to the code: </p> <pre class="lang-cs prettyprint-override"><code>this.ingredientImage.Source = null; </code></pre> <p>The code was still throwing the exception, though. So I tried something else: I removed the Image from the GridView in <strong>Ingredients.xaml</strong>. The only place the image is shown not is in <strong>Ingredient.xaml</strong>. When I try to replace/delete the image, <code>Image.Source</code> is set to null and the file is successfully replaced/deleted. </p> <p>Apparently the Image in the GridView on the previous Page is still blocking the file, but I have no idea how I could release the file when I navigate away.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload