windows-phone-8 - 有什么方法可以调整 Windows Phone 8 动态磁贴背面的文字大小?

标签 windows-phone-8 live-tile

我正在使用 Flip Template为了我的瓷砖。在 MSDN 页面上,可以看到文本换行,而且尺寸更小。

这并不代表我在动态磁贴中看到的行为。我最多可以在宽动态磁贴上获得 3 行大文本。文本不换行。这发生在模拟器的所有不同屏幕尺寸上。令人沮丧的是,我可以在 Medium 动态磁贴上获得 4 行文本,但额外的内容行太长,无论如何都放不下,所以我没有包含它。

我使用计划任务定期更新我的磁贴:

Earthquake latest = quakes.First();
newTileData = new FlipTileData
{
    Title = String.Format(AppResources.LiveTileTitleFormat, quakes.Count),
    BackTitle = String.Format(AppResources.LiveTileTitleFormat, quakes.Count),
    BackContent = String.Format(AppResources.LiveTileBackContentFormat,  latest.FormattedMagnitude, latest.FormattedDepth),
    WideBackContent = String.Format(AppResources.LiveTileWideBackContentFormat, latest.FormattedMagnitude, latest.FormattedDepth, latest.RelativeLocation)
};

ShellTile tileToFind = ShellTile.ActiveTiles.First();
if (tileToFind != null)
{
    tileToFind.Update(newTileData);
}

左边的模拟器试图显示 4 行。 右侧的模拟器显示的文本未换行。

enter image description here

那么,有什么方法可以强制添加第四行,或指定较小的字体大小,或两者兼而有之?我怀疑没有,MSDN 文章只是展示了 Windows 8(不是 WP8)动态磁贴。

最佳答案

无法调整 WP8 磁贴上的文本大小。您可以通过创建图像并将其放在图 block 上来伪造它:

  1. 创建一个包含图像控件和文本 block 的用户控件
  2. 将平铺图像分配给图像控件,将具有所需大小的文本分配给文本 block 。
  3. 然后通过以下代码创建控件的快照。
  4. 使用此图像实现切片生成。

     private WriteableBitmap RenderControlAsImage(UserControl element)
     {
        element.UpdateLayout();
        element.Measure(new Size(element.Width, element.Height));
        element.Arrange(new Rect(0, 0, element.Width, element.Height));
        return new WriteableBitmap(element, null);
     }
    

关于windows-phone-8 - 有什么方法可以调整 Windows Phone 8 动态磁贴背面的文字大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13784698/

相关文章:

c# - Windows Phone Back KeyPress + MessageBox 在没有选择的情况下使应用程序崩溃

c# - 将新的 XElement 添加到 Xdocument

c# - 如何删除 Windows Phone 8.1 应用程序中的动态磁贴标题?

c# - Live Tiles UWP Windows 10 - 不更新 livetiles 队列

c# - Windows Phone 8.1 如何以编程方式创建具有指定模板的磁贴

c# - 是否可以通过从应用程序中获取值而不在 WP7 中触发它来更新动态磁贴?

c# - 我可以在 WinRT 中更改主磁贴的背景颜色吗?

c# - 如何防止WP8全景控件暂时滑动?

c# - 浏览器控件 NavigateToString 显示 HTML 代码而不是渲染页面

xaml - Windows Phone 8 诺基亚 map : How to change the design of a Microsoft. Phone.Maps.Toolkit 图钉?