在winJs中更改AppBarCommand的图像样式

时间:2013-10-21 09:23:30

标签: windows-8 winjs windows-8.1 navbar appbar

我在Windows 8.1的winJs 2.0中看到了新的导航栏控件,非常简单。

但他们是如何在Windows 8中开发天气应用程序导航栏的呢?我的意思是漂亮的大方形按钮而不是小圆形按钮?

我找到的唯一方法就是拥有一个appbar并且不使用任何AppBarCommands(因为我找不到改变那些形状的方法)但只有div并手动完成所有样式。

这是唯一的解决方案还是可以对圆圈进行平方?

1 个答案:

答案 0 :(得分:0)

我最终发现了自己,改变这些类可以完全改变AppBarCommand的风格:

CSS class           Description
win-command         Styles the entire AppBarCommand.
win-commandicon     Styles the icon box for the AppBarCommand.
win-commandimage    Styles the image for the AppBarCommand.
win-commandring     Styles the icon ring for the AppBarCommand.
win-label           Styles the label for the AppBarCommand.

例如对圆圈进行平方:

.win-appbar .win-commandring
{
    border-radius: 0;
}

.win-appbar:hover .win-commandring
{
    border-radius: 0;
}

彻底改变所有默认行为是一项艰巨的任务,但可以这样做。

请看一下主要样式的示例:http://msdn.microsoft.com/en-us/library/windows/apps/jj839733.aspx