ThemeColor在Microsoft Band 2 SDK中不存在。

3

我正在按照Microsoft Band SDK文档中的示例进行操作,以使用主题色填充按钮,但由于Color和ThemeColor.BandBase不存在于任何软件包中,因此代码无法编译。示例中的代码如下:

FilledPanel panel = new FilledPanel 
{ 
  Rect = new PageRect(0, 0, 245, 102), 
  Color = ThemeColor.BandBase 
};

我假设“Color”应该是“BackgroundColor”,因为该属性存在,但我找不到任何类似于“ThemeColor”的可用选项。有人知道我可以使用什么吗?
更新:我认为我可能已经解决了这个问题:
BandTheme theme = await bandClient.PersonalizationManager.GetThemeAsync();

// create a filled rectangle to provide the background for a button 
FilledPanel panel = new FilledPanel
{
  Rect = new PageRect(0, 0, 245, 102,
  BackgroundColor = theme.Base
};

尚未测试。如果有效,将添加为答案。


对我来说工作正常。谢谢... - Joe Healy
1个回答

0

我相信你选择的方法应该可以工作。

你也可以使用静态访问器:

FilledPanel panel = new FilledPanel
{
  Rect = new PageRect(0, 0, 245, 102,
  BackgroundColor = ThemeColor.BandBase
};

ThemeColor.BandBase 对我来说不起作用。我是否缺少声明? - doktorg
抱歉,刚刚重新阅读了您的问题。微软的文档非常简略,因此我建议如果您当前的实现可以工作,请继续使用它!希望微软的API和文档能够在不久的将来得到更新和改进。 - timothyclifford

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接