Different Windows Phone (8) Tile (magnetic paste)

Source: Internet
Author: User
Tags relative xmlns

Introduced

Unusual Windows Phone 7.5 (SDK 7.1) Magnetic stickers

Overview

Demonstrates how to create, update, and delete tiles

Demonstrates how to update the positive background of a tile as planned

Example

1, create, update, delete the magnetic paste Demo

Shelltiledemo.xaml

<phone:phoneapplicationpage x:class= "Demo.Tile.ShellTileDemo" xmlns= "http://schemas.microsoft.com/winfx/2006 /xaml/presentation "xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "xmlns:phone=" Clr-namespace: Microsoft.phone.controls;assembly=microsoft.phone "Xmlns:shell=" clr-namespace:microsoft.phone.shell;assembly= Microsoft.phone "xmlns:d=" http://schemas.microsoft.com/expression/blend/2008 "xmlns:mc=" http:// schemas.openxmlformats.org/markup-compatibility/2006 "fontfamily=" {StaticResource PhoneFontFamilyNormal} "FontSiz E= ' {StaticResource phonefontsizenormal} ' foreground= ' {StaticResource Phoneforegroundbrush} ' SupportedOrientations= "Portrait" orientation= "Portrait" mc:ignorable= "D" d:designheight= "768" d:designwidth= "The Shell:SystemTray.IsVis" ible= "True" > <stackpanel orientation= "Vertical" > <textblock name= "lblmsg"/> ; Button Name= "Btnupdateapplicationtile" content= "Update application TIle "click=" Btnupdateapplicationtile_click "/> <button name=" btncreatesecondarytile "Content=" Create Secondary Tile (can create multiple) "click=" Btncreatesecondarytile_click "/> <button name=" btndeletesecondarytile "Content=" Delete all S Econdary Tile "click=" Btndeletesecondarytile_click "/> </StackPanel> </phone:phoneapplicationpage&gt ;

ShellTileDemo.xaml.cs

* * * Tile-Magnetic paste * Tile size is 173 * 173; wide Tile size 356 * 173, need to change manifest <TemplateType5> to <templatety Pe6&gt, but not through Microsoft Audit * Tile is divided into application tiles (application Tile) and secondary tiles (secondary Tile) * Program-Secure how to have a application Tile (whether or not it is 
Fixed to the start screen, it can only be updated (cannot be created and deleted), while secondary Tile can be created, updated, and deleted, secondary Tile if existence must be on the start screen * * using System; 
Using System.Collections.Generic; 
Using System.Linq; 
Using System.Net; 
Using System.Windows; 
Using System.Windows.Controls; 
Using System.Windows.Documents; 
Using System.Windows.Input; 
Using System.Windows.Media; 
Using System.Windows.Media.Animation; 
Using System.Windows.Shapes; 
   
Using Microsoft.Phone.Controls; 
   
Using Microsoft.Phone.Shell; namespace Demo.tile {public partial class Shelltiledemo:phoneapplicationpage {public Shelltiledemo 
        () {InitializeComponent (); 
    } protected override void Onnavigatedto (System.Windows.Navigation.NavigationEventArgs e)    {//demo to get the parameter data passed over after clicking Tile if (NavigationContext.QueryString.Count > 0) Lblmsg.text = "The value of the parameter T is:" + this. 
   
            navigationcontext.querystring["T"]; Base. 
        Onnavigatedto (e); 
             } private void Btnupdateapplicationtile_click (object sender, RoutedEventArgs e) {/*  
             * Standardtiledata-Used to describe the Tile data * title-positive title * BackgroundImage-Positive background * Count-Badge (coat of arms) shown on the front, range 1-99 * Backtitle-Back caption * backbackg  Roundimage-Back background * backcontent-back content * * * shelltile- Used to manage application Tile and secondary Tile * Update (Standardtiledata data)-Update existing Tile information with specified Tile data * De Lete ()-Remove this Tile * Navigationuri-this Tile's navigation address * * SHELLTILE.ACTI Vetiles-Fixed to the Tile collection on the Start screen.Note: The first element must be application tile, whether or not it is pinned to the home * shelltile.create (Uri Navigationuri, Shelltiledata Initialda TA)-Create a new secondary Tile (if there is a secondary Tile, which is bound to be fixed to the start screen) * Navigationuri-click on the address that is navigated to after Tile, this value phase 
             When the key value, cannot repeat * initialdata-need to create the Tile data * * NOTE: * When a secondary tile is created, the background image must use local resources (in either the package or isolated storage, or in the case of isolated storage, the image must be located in shared/shellcontent) * When updating application tiles or secondary tiles, you can use local resources or Remote resources to update the background image * The tile image can be a JPG or PNG or GIF (only the first frame is displayed), and the background of the transparent area of the PNG or GIF renders the theme color * When using remote images, you cannot be https, less than 80KB, must be downloaded within 30 seconds///Create application Tile Demo shelltile applicationtile = Shelltile.a 
   
            Ctivetiles.first (); 
                Standardtiledata newtile = new Standardtiledata {title = "App Fore Tile title", 
   BackgroundImage = new Uri ("Tilebackgroundblue.png", urikind.relative), Count = 6,             Backtitle = "App back Tile Title", backbackgroundimage = new Uri ("Tilebackgroundgreen.png", 
   
            urikind.relative), backcontent = "App back Tile Content" + Environment.NewLine + "OK"}; 
        Applicationtile.update (Newtile);  } private void Btncreatesecondarytile_click (object sender, RoutedEventArgs e) {//Create secondary Tile's Demo standardtiledata newtile = new Standardtiledata {Title = "Seconda 
                Ry Fore Tile Title ", backgroundimage = new Uri (" Tilebackgroundblue.png ", urikind.relative), Count = 6, Backtitle = "Secondary back Tile Title", backbackgroundimage = new Uri ("T Ilebackgroundgreen.png ", urikind.relative), backcontent =" Secondary back Tile Content "+ environment.new 
   
            Line + "OK"}; URI is key cannot repeat Shelltile.create(New Uri ("/tile/shelltiledemo.xaml?t=" + DateTime.Now.Ticks.ToString (), urikind.relative), newtile); } private void Btndeletesecondarytile_click (object sender, RoutedEventArgs e) {//Remove all Secondary magnetic paste if (ShellTile.ActiveTiles.Count () > 1) {shelltile lasttile = Shelltile . 
                Activetiles.last (); 
            Lasttile.delete (); 
            //XNA Shutdown Application: Microsoft.Xna.Framework.Game.Exit (); 
        SL Shutdown Application throw new Exception (); } 
    } 
}

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

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.