Search code examples
c#windows-phone-7live-tile

How to set initial values for the Application Tile


I would like my application tile to have the flip animation, and I have attempted to set these values in the codebehind of my MainPage, but for some reason the Application Tile does not perform the flip animation. I believe I set the back side values properly. What I have is as follows:

MainPage.xaml.cs

public void CreateApplicationTile()
    {
        var appTile = ShellTile.ActiveTiles.First();

        if (appTile != null)
        {
            var standardTile = new StandardTileData
            {
                Title = "ShareSky",
                BackgroundImage = new Uri("/Background.png", UriKind.Relative),
                BackTitle = "ShareSky",
                BackBackgroundImage = new Uri("/Background.png", UriKind.Relative),
                //BackContent = "click me!"                    
                BackContent = AppResource.Main_MainPage_ApplicationTile_BackContent
            };

            appTile.Update(standardTile);
        }
    }

As I understand, this method does not need to be associated with any events of any type (such as a click) to make it work. I am unsure of what I am doing wrong here? If I have to edit the WMAppManifest file, how would I correctly do this to incorporate the backside of the tile information?


Solution

  • Silly question but are you actually calling "CreateApplicationTile" in your constructor? If you didn't it would never activate.

        public MainPage()
        {
            InitializeComponent();
            CreateApplicationTile();
        }
    

    I ran the following and got the nice happy rollovers.

       var appTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString() == "/");
       if (appTile != null)
       {
            var standardTile = new StandardTileData
            {
                    Title = "ShareSky",
                    BackgroundImage = new Uri("/Background.png", UriKind.RelativeOrAbsolute),
                    BackTitle = "ShareSky",
                    BackBackgroundImage = new Uri("/flipped.png", UriKind.RelativeOrAbsolute),
                    BackContent = "backcontent load"
            };
    
            appTile.Update(standardTile);
         }