Note that there are some explanatory texts on larger screens.

plurals
  1. POPass image between pages
    text
    copied!<p>I want to pass image between pages. On one of the pages loads a picture, so I have the source. However, I do not know how to pass this image (source) to another page?</p> <p>I tried converting to a string, but I think it's not a good way to go.</p> <p>EDIT:</p> <p>Method 1: First Page</p> <pre><code>WriteableBitmap wb = new WriteableBitmap(logoQrCodeImage, null); if (!IsolatedStorageSettings.ApplicationSettings.Contains("State")) { IsolatedStorageSettings.ApplicationSettings["State"] = wb; IsolatedStorageSettings.ApplicationSettings.Save(); } </code></pre> <p>Second Page:</p> <pre><code> if (IsolatedStorageSettings.ApplicationSettings.Contains("State")) { WriteableBitmap wb = IsolatedStorageSettings.ApplicationSettings["State"] as WriteableBitmap; icon.Source = wb; IsolatedStorageSettings.ApplicationSettings.Remove("State"); IsolatedStorageSettings.ApplicationSettings.Save(); } </code></pre> <p>And error is in line:</p> <pre><code>IsolatedStorageSettings.ApplicationSettings.Save(); </code></pre> <p>Error message:</p> <blockquote> <p>'System.Runtime.Serialization.InvalidDataContractException' occurred in System.Runtime.Serialization.ni.dll but was not handled in user code</p> </blockquote> <p>Method 2: First Page:</p> <pre><code>PhoneApplicationService.Current.State["iconLogo"] = logoQrCodeImage.Source; </code></pre> <p>Second Page:</p> <pre><code> Uri url = new Uri(iconImage, UriKind.Relative); BitmapImage bmp = new BitmapImage(url); icon.Source = bmp; </code></pre>
 

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