Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Save your image to Isolated Storage instead of project folder. Then retrieve the image from isolated storage whenever you want like this,</p> <pre><code> var lockimageuri = new Uri("ms-appdata:///Local/" + "lockimage0.jpg", UriKind.Absolute); LockScreen.SetImageUri(lockimageuri); </code></pre> <p>Here locimage0.jpg is the image that present in the isolated storage.</p> <p>Here is the code to save your image into Isolated storage.</p> <pre><code> using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { string filePath = "lockimage0.jpg"; if (store.FileExists(filePath)) { store.DeleteFile(filePath); } IsolatedStorageFileStream fileStream = store.CreateFile(filePath); wbm.SaveJpeg(fileStream, wbm.PixelWidth, wbm.PixelHeight, 0, 100); fileStream.Close(); } </code></pre> <p>Also You can use this method to read your local image from project folder.</p> <pre><code> private WriteableBitmap ReadLocalImage(string Uri) { StreamResourceInfo sri = null; Uri uri = new Uri(Uri, UriKind.Relative); sri = Application.GetResourceStream(uri); BitmapImage bitmap = new BitmapImage(); bitmap.CreateOptions = BitmapCreateOptions.None; bitmap.SetSource(sri.Stream); WriteableBitmap wb = new WriteableBitmap(bitmap); return wb; } </code></pre> <p>This is how I implemented custom lock screen in my application.</p> <p>Also make sure that you updated the Manifest file</p> <pre><code>&lt;Extensions&gt; &lt;Extension ExtensionName="LockScreen_Background" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" /&gt; &lt;/Extensions&gt; </code></pre> <p>I also tried with image in local project folder, That also working fine for me. Here is the code I tried.</p> <pre><code>private async void SetLockScreen() { //Check to see if the app is currently the lock screen provider if (!LockScreenManager.IsProvidedByCurrentApplication) { //Request to be lock screen provider await LockScreenManager.RequestAccessAsync(); } //Check to see if the app is currently the lock screen provider if (LockScreenManager.IsProvidedByCurrentApplication) { //Set the image to the lock screen image Uri imageUri = new Uri("ms-appx:///Images/lockscreen.png", UriKind.RelativeOrAbsolute); LockScreen.SetImageUri(imageUri); } } </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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