Windows Phone 7 (WP7) Development custom tile (deep link)

Source: Internet
Author: User

Those who have used WP7 mobile phones should be impressed with the built-in office. A menu will appear when the icon of each document is long pressed, which can be "fixed to the Start Screen" and fixed to the icon on the Start Screen, click it to open the document.

Another example is that a contact in the "contacts" can be fixed to the Start Screen by a long press, and the contact with the contact can be opened more conveniently next time.

Another example is that a contact of Sina Weibo can also be fixed to the Start Screen by a long press. Next time, click his avatar on the Start Screen to open his Weibo homepage. The legendary crush function: You pay attention to him/her on your mobile phone, but he/she does not know.

 

This is a good function. This is the custom tile-deep link. It can directly navigate the user to a page in your application, instead of entering from your home page.

I have not been busy writing my articles too much recently. Today I have made a very rough and simple program (which saves all my time, just to illustrate the problem of custom magnetic stickers, image source Bing). For details, see:

  

  

OK, now, how ......

1. The two square controls used on the home page are hubtile; the one that appears with a long press is contextmenu; both of them use the silverlighttoolkit for WP7 control package, just download it with nuget. (These two are not important for deep magnetic stickers. You can use one button or another)

The XAML code of News 1 is as follows:

  

<Toolkit: hubtile horizontalalignment = "Left" margin = "," verticalignment = "TOP" D: layoutoverrides = "width, height "Source =" images/t1.png "Title =" News 1 "message =" 111111 ">
<I: interaction. triggers>
<I: eventtrigger eventname = "tap">
<EC: navigatetopageaction targetpage = "/newsview. XAML? Id = 1 "/>
</I: eventtrigger>
</I: interaction. triggers>
<Toolkit: contextmenuservice. contextmenu>
<Toolkit: contextmenu>
<Toolkit: menuitem header = "fixed to Start Menu" Click = "menuitem_hub_click1"/>
</Toolkit: contextmenu>
</Toolkit: contextmenuservice. contextmenu>
</Toolkit: hubtile>

Explain the above Code. If you tap this hubtile, you can directly go to the details page of News 1. If you press it for a long time, the menu is triggered.

2. The above menuitem_hub_click1 handler:

  

Private void menuitem_hub_click1 (Object sender, routedeventargs E)
{
Viewoperate. pintostart ("News 1", "/images/t1.png", "News 1", "1111", "", "/newsview. XAML? Id = 1 ");
}

3. viewoperate class (names can be retrieved by yourself ):

  

Using system;
Using system. LINQ;
Using Microsoft. Phone. shell;

Namespace pintostart
{
Public class viewoperate
{
Public static void pintostart (String title, string image, string backtitle, string backcontent, string backimage, string URL)
{
// If yes, delete it and pin it to the desktop again below
Shelltile oldtile = shelltile. activetiles. firstordefault
(E => E. navigationuri. tostring (). Contains (URL ));
If (oldtile! = NULL)
{
Oldtile. Delete ();
}

// Generate Tile
Standardtiledata mytile = new standardtiledata
{
Backgroundimage = new uri (image, urikind. Relative ),
Title = title,
Count = 0,
Backtitle = backtitle,
Backcontent = backcontent,
Backbackgroundimage = new uri (backimage, urikind. Relative)
};
// Fixed to the start Interface
Shelltile. Create (New uri (URL, urikind. Relative), mytile );
}
}
}

Easy to complete ~

NOTE: For the sake of simplicity and time problems, the above example shows that many codes are not well written. We recommend that you improve them on your own.

Source code download: http://vdisk.weibo.com/s/2fmlH

  

 

Please indicate the source for reprinting ~ Http://www.cnblogs.com/vistach/archive/2012/02/01/Windows_Phone_WP7_Develop_Tile_StandardTileData_ShellTile_DeepLink.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.