2

我在这样的代码中定义了我的 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 的情况下执行此操作时,我可以同时看到图标 + 文本,但白色是我不感兴趣的

4

1 回答 1

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);

    }
于 2012-08-20T18:00:17.013 回答