Telerik UI for Windows Phone by Progress

This topic describes the different tile templates that can be used by LiveTileHelper.

AreNewTilesSupported property

LiveTileHelper can be used with the following types of tile data in order to provide different tile experience: RadFlipTileData, RadIconicTileData, RadCycleTileData, RadExtendedTileData. The first three implement the ITileData interface. This interface includes the tile datas that represent the tile templates added with Windows Phone 8. With LiveTileHelper you can add these types in Windows Phone 7 applications as well. However, they are available on Windows Phone 7 devices only if their OS has been updated to version 7.8. In order to check if the OS of the device running your application supports this type of tiles (meaning its version is WP7.8 or higher), you can use the AreNewTilesSupported property of LiveTileHelper:

CopyC#
if (LiveTileHelper.AreNewTilesSupported)
{
    //create tile with LiveTileHelper.CreateTile(ITileData tileData, Uri navigationUri, bool supportsWideTile);
}
else
{
    //create tile with LiveTileHelper.CreateTile(RadExtendedTileData extendedTileData, Uri navigationUri);
}

ITileData

The ITileData interface is implemented by RadFlipTileData, RadIconicTileData, RadCycleTileData. Each of these types of tile data contain properties which can be set to Visual Element that will be used instead of the image properties in the native types of tile data. Here are these properties for each of the data types.

  • RadFlipTileData - VisualElement (used as BackgroundImage), BackVisualElement (as BackBackgroundImage), SmallVisualElement (as SmallBackgroundImage), WideVisualElement (as WideBackgroundImage), WideBackVisualElement (as WideBackBackgroundImage)
  • RadIconicTileData - IconVisualElement (as IconImage), SmallIconVisualElement (as SmallIconImage)
  • RadCycleTileData - SmallVisualElement (as SmallBackgroundImage), CycleVisualElements (as CycleImages)

Here's an example with RadIconicTileData:

CopyXAML
<Grid Grid.Row="1" x:Name="VisualElement" Width="113" Height="113">
    <Rectangle Fill="Blue" Width="80" Height="80"/>
    <Rectangle Fill="Blue" Width="80" Height="80">
        <Rectangle.RenderTransform>
            <RotateTransform Angle="45" CenterX="40" CenterY="40"/>
        </Rectangle.RenderTransform>
    </Rectangle>
</Grid>
<Button Grid.Row="2" VerticalAlignment="Top" Content="pin to start" Click="PinToStart_Click"/>

And here is the code-behind for creating the tile:

CopyC#
private void PinToStart_Click(object sender, RoutedEventArgs e)
{
    RadIconicTileData iconicTileData = new RadIconicTileData();
    iconicTileData.Count = 5;
    iconicTileData.Title = "my app";
    iconicTileData.IconVisualElement = this.VisualElement;
    Uri uri = new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute);
    LiveTileHelper.CreateOrUpdateTile(iconicTileData, uri, true);
}

The result is that the visual element that we had in our application is now the icon in the Iconic Tile:

Live Tile Helper-Tile Templates-Iconic-01
Live Tile Helper-Tile Templates-Iconic-02
Note

Please note that trying to access the RadIconicTileData (or RadFlipTileData and RadCycleTileData) on a WP7 device that hasn't been updated to WP7.8 would cause an exception. In order to avoid this, while developing Windows Phone 7 applications always check the value of LiveTileHelper's AreNewTilesSupported property and only if it is true, proceed to the creation of RadIconicTileData. While developing for Windows Phone 8 (or later) you don't need such precautions.

RadExtendedTileData

The RadExtendedTileData extends the StandartTileData and can be used in both Windows Phone 7 and Windows Phone 8. This is the type that you should use if you don't want the new tile templates or if you are developing a Windows Phone 7 application and the value of the AreNewTilesSupported property is false. Here's an example:

CopyC#
Uri uri = new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute);
if (LiveTileHelper.AreNewTilesSupported)
{
    RadFlipTileData flipTileData = new RadFlipTileData()
    {
        VisualElement = this.VisualElement,
        Title = "my app"
    };
    LiveTileHelper.CreateOrUpdateTile(flipTileData, uri, false);
}
else
{
    RadExtendedTileData extendedTileData = new RadExtendedTileData()
    {
        VisualElement = this.VisualElement,
        Title = "my app"
    };
    LiveTileHelper.CreateOrUpdateTile(extendedTileData, uri);
}
Note

Please note that RadExtendedTileData can be used on all Windows Phone devices disregarding the value of the AreNewTilesSupported property in Windows Phone 7's LiveTileHelper. However, in order to take advantage of the new capabilities in Windows Phone 7.8 (and higher), use RadExtendedTileData only if the other types of tile data are not supported.