uwplive-tile

Is there any way to customize the template of tile?


Now I implement live tile on my UWP application.

I found some tile template on MSDN(https://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx?f=255&MSPPError=-2147217396#versions) but i want to change the style of template such as text size. In my investigation, I didn't find any way to change the template of tile. Is there any way to change that? Or is there any way to use custom template?

string tileXmlString = "<tile>"
                             + "<visual>"
                             + "<binding template='TileWide310x150SmallImageAndText04'>"
                             + "<image id='1' src='ms-appx:///images/tile-sdk.png'/>"
                             + "<text id='1'>TEXT ID 1</text>"
                             + "<text id='2'>TEXT ID 2</text>"
                             + "</binding>"
                             + "</visual>"
                             + "</tile>";

Thanks in advance.


Solution

  • You're using a legacy tile template. What you're looking for in UWP are adaptive tile templates, which are entirely customizable, and don't rely on fixed templates like the legacy ones (which come from Windows 8/8.1).

    In adaptive tile templates, you use the hint-style attribute to customize your text elements rather than IDs that map to fixed text blocks. Here's the first example that's given by the link above:

    <tile>
      <visual>
    
        <binding template="TileMedium">
          ...
        </binding>
    
        <binding template="TileWide">
          <text hint-style="subtitle">Jennifer Parker</text>
          <text hint-style="captionSubtle">Photos from our trip</text>
          <text hint-style="captionSubtle">Check out these awesome photos I took while in New Zealand!</text>
        </binding>
    
        <binding template="TileLarge">
          ...
        </binding>
    
      </visual>
    </tile>
    

    Result: