我在代码中定义了我的ApplicationBar:
private void BuildApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
ApplicationBar.Opacity = 0.8;
ApplicationBar.ForegroundColor = Color.FromArgb(0, 138, 204, 34);
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton CheckInExitAppBarButton = new ApplicationBarIconButton(new Uri("icons/check_in.png", UriKind.Relative));
CheckInExitAppBarButton.Text = AppResource.CheckInExit;
ApplicationBar.Buttons.Add(CheckInExitAppBarButton);
CheckInExitAppBarButton.Click += new EventHandler(CheckInExitAppBarButton_Click);
}
看到我可以看到图标的颜色发生了变化,但我看不到它们下面的文字。当我在没有ApplicationBar.Color的情况下执行此操作时,我可以看到图标+文本但是白色,这对我不感兴趣
答案 0 :(得分:5)
文本使用前景色的alpha值,并将其设置为0(透明)。将其设置为255,它将起作用:
private void BuildApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
ApplicationBar.Opacity = 0.8;
ApplicationBar.ForegroundColor = Color.FromArgb(255, 138, 204, 34);
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton CheckInExitAppBarButton = new ApplicationBarIconButton(new Uri("icons/check_in.png", UriKind.Relative));
CheckInExitAppBarButton.Text = AppResource.CheckInExit;
ApplicationBar.Buttons.Add(CheckInExitAppBarButton);
CheckInExitAppBarButton.Click += new EventHandler(CheckInExitAppBarButton_Click);
}