In versions earlier than Windows Phone 7 (nodo ), Program When you press an application in the list, the "pin to start" option will pop up. After the selection, the system will pin the shortcut of the application to the startup interface, similar to the desktop shortcut on Windows. At that time, the startup interface is the background.png in the application. If you haven't changed the configuration, the image from pin to start is roughly as follows:
In mango, we can do more (in nodo, we can only change the display name of the background image and application). In mango, we can: 1. Dynamically update the background image from the pin to the desktop 2. Create a secondary tile to make our tile more live3. You can use the back agent to dynamically update count marining. This is a good introduction. Article Ma Ning's first Windows Phone 7.1 experience (3) -- Tile
The following describes a little advanced knowledge.
1. InCodeMerging images in
I will use the following three images in the project:
The first backbg.png is the background image for secondary tile. It is used to synthesize the third image and generate a new secondary tile background image. The middle image is the background image of tile. The final result is as follows:
The idea of merging an image is to use writeablebitmap to save the uielement as an image. The following is the detailed code:
Public Static String Createbackground ()
{
Grid = New Grid
{
Background = New Imagebrush
{
Imagesource = New Bitmapimage
{
Urisource = New Uri ( " /Mangtile; component/images/backbg.png " , Urikind. Relative ),
Createoptions = Bitmapcreateoptions. ignoreimagecache
}
},
Width = 173 ,
Height = 173
};
Image profileimg = New Image
{
Height = 48 ,
Width = 48 ,
Source = New Bitmapimage
{
Urisource = New Uri ( " /Mangtile; component/images/u97911.jpg " , Urikind. Relative ),
Createoptions = Bitmapcreateoptions. ignoreimagecache
},
};
Grid. Children. Add (profileimg );
Grid. Arrange ( New Rect (0d, 0d, 173 , 173 ));
Writeablebitmap wbmp = New Writeablebitmap (grid, Null );
String Tiledirectory = " Shared/shellcontent/tiles " ; // Note: The parent directory must be shared/shellcontent.
String Fullpath = Tiledirectory + @" / " + " Livetile.jpg " ;
Using (VAR store = Isolatedstoragefile. getuserstoreforapplication ())
{
If ( ! Store. directoryexists (tiledirectory ))
{
Store. createdirectory (tiledirectory );
}
Using (VAR stream = Store. openfile (fullpath, system. Io. filemode. openorcreate ))
{
Wbmp. savejpeg (stream, 173 , 173 , 0 , 100 );
}
}
Return " Isostore :/ " + Fullpath; } Standardtiledata std = New Standardtiledata
{
Backgroundimage = New Uri ( " /Background.png " ),
Title = "" ,
Backtitle = " Secondary " ,
Backbackgroundimage = New Uri (createbackground ())
};
Shelltile. Create (NewUri ("/Mainpage. XAML", Urikind. Relative), STD );
2. activetiles attribute of shelltile
Msdn is interpreted as contains the collection of an applications tiles pinned to start. It is a set that contains the pin to start of the application. Note that:
First, it refers to the current application, not all applications.
Second, no matter whether your application has a pin to start, activetiles always contains a default tile (URI is "/"), and always is the first
Third, if you say URI is "/mainpage. XAML" pin to the desktop, activetiles contains two tile (URI is "/" and/mainpage. XAML respectively)
Source codeDownload: