Calling a generic API to set up a desktop wallpaper is a simple and fun thing to combine with XAML to generate image features, and you can even do an app that lets users make a custom wallpaper from the photos he takes, and then as a desktop wallpaper.
This API is generic and can be used on any Windows device, including mobile phones, of course. Under the Windows.System.UserProfile namespace, there is a class called userprofilepersonalizationsettings, which can modify the lock screen wallpaper and desktop wallpaper, after the call will return a bool value, if the success is true, if the character is not good to return False
Before calling the Userprofilepersonalizationsettings class, first visit the IsSupported method to see if the operation is supported. You can then get a userprofilepersonalizationsettings instance through the current property, and then you can set the wallpaper.
Call the Trysetlockscreenimageasync method to set the lock screen wallpaper, call the Trysetwallpaperimageasync method to set the desktop wallpaper, parameters are used as the background of the picture file of the storagefile.
As you can see from this, it is really easy to use and show you an example:
//Set Wallpaper if(!userprofilepersonalizationsettings.issupported ()) {MsgBox. Content="character problem, unsupported operation. "; awaitMsgBox. Showasync (); return; } userprofilepersonalizationsettings Settings=userprofilepersonalizationsettings.current; BOOLb =awaitsettings. Trysetwallpaperimageasync (file); if(b) {MsgBox. Content="Setup succeeded. "; } Else{MsgBox. Content="The operation failed. "; }
Look at the effect. Running on the PC is like this.
Running on the phone is like this.
Then to set the phone desktop wallpaper as an example, after modifying the wallpaper Start screen is like this.
How, isn't it very simple.
Example: Http://files.cnblogs.com/files/tcjiaan/CustomWallpage.zip
"WIN10 Application Development" Custom desktop wallpaper