Styling Windows Phone 8.1/WinRT AppBarButton

2019-05-22 15:01发布

I'm currently looking to implement a CommandBar for a WinRT Windows Phone 8.1 app. Overall it is very straightforward but I am unable to style the control.

I have themed my app so that the accent colour has been changed to green. This works well for pretty much everywhere in the app (buttons, textblocks etc.) but not for the AppBarButton.

The brushes I'm overriding are SystemColorControlAccentBrush and PhoneAccentBrush but changing these does not make any difference to the colour of the AppBarButton when pressed: AppBarButtonPressed

Any idea what I'm doing wrong/can this colour be changed?

2条回答
Melony?
2楼-- · 2019-05-22 15:27

Set the CommandBar's foreground and background colors.

The command bar on Windows Phone is system UI not app UI and does not allow customizing the colors of individual AppBarButtons. Their colors always come from the CommandBar's colors.

查看更多
三岁会撩人
3楼-- · 2019-05-22 15:49

try changing app bar button color

            <AppBarButton x:Uid="SendMessageButton" Icon="Send" Foreground="" Background=""  Command="{Binding SendMessageCommand}" IsEnabled="{Binding IsSendMessageButtonEnabled}"/>

or change in code behind

  AppBarButton app = new AppBarButton();
            app.Foreground="";
            app.Background="";
查看更多
登录 后发表回答